Browse Source

fix for opera DSK-354448: onclick fired on disabled nodes with opaque content

Steffen Märcker 13 years ago
parent
commit
548591fcf5
  1. 18
      web/compatibility.js

18
web/compatibility.js

@ -234,3 +234,21 @@
console = {log: function() {}}; console = {log: function() {}};
} }
})(); })();
// Check console compatability
(function checkOnClickCompatibility() {
// workaround for reported Opera bug DSK-354448:
// onclick fires on disabled buttons with opaque content
function ignoreIfTargetDisabled(event) {
if (isDisabled(event.target)) {
event.stopPropagation();
}
}
function isDisabled(node) {
return node.disabled || (node.parentNode && isDisabled(node.parentNode));
}
if (navigator.userAgent.indexOf('Opera') != -1) {
// use browser detection since we cannot feature-check this bug
document.addEventListener('click', ignoreIfTargetDisabled, true);
}
})();
Loading…
Cancel
Save