Compatibility with XHTML documents

Previously, when the XHTML doctype + header is active, checks
would fail because a <div>'s tag name is "div" instead of "DIV".

document.activeElement does not exist in Chrome for XHTML documents

== -> ===
This commit is contained in:
Rob Wu 2013-03-30 18:12:32 +01:00
parent e181a3c902
commit b46c375126
2 changed files with 4 additions and 4 deletions

View File

@ -46,7 +46,7 @@ var FontInspector = (function FontInspectorClosure() {
}
}
function textLayerClick(e) {
if (!e.target.dataset.fontName || e.target.tagName != 'DIV')
if (!e.target.dataset.fontName || e.target.tagName.toUpperCase() !== 'DIV')
return;
var fontName = e.target.dataset.fontName;
var selects = document.getElementsByTagName('input');

View File

@ -3494,9 +3494,9 @@ window.addEventListener('keydown', function keydown(evt) {
// Some shortcuts should not get handled if a control/input element
// is selected.
var curElement = document.activeElement;
if (curElement && (curElement.tagName == 'INPUT' ||
curElement.tagName == 'SELECT')) {
var curElement = document.activeElement || document.querySelector(':focus');
if (curElement && (curElement.tagName.toUpperCase() === 'INPUT' ||
curElement.tagName.toUpperCase() === 'SELECT')) {
return;
}
var controlsElement = document.getElementById('toolbar');