From 548591fcf580869803e6c713cba0489327bf852d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20M=C3=A4rcker?= Date: Mon, 16 Apr 2012 19:17:49 +0200 Subject: [PATCH 1/3] fix for opera DSK-354448: onclick fired on disabled nodes with opaque content --- web/compatibility.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/web/compatibility.js b/web/compatibility.js index 9f139b7dd..b63ba35d8 100644 --- a/web/compatibility.js +++ b/web/compatibility.js @@ -234,3 +234,21 @@ 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); + } +})(); \ No newline at end of file From d3a88411ecdb9434a464b92d54bed28257c62a4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20M=C3=A4rcker?= Date: Mon, 16 Apr 2012 19:23:54 +0200 Subject: [PATCH 2/3] corrected comment --- web/compatibility.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/compatibility.js b/web/compatibility.js index b63ba35d8..2a170ec37 100644 --- a/web/compatibility.js +++ b/web/compatibility.js @@ -235,7 +235,7 @@ } })(); -// Check console compatability +// Check onclick compatibility in Opera (function checkOnClickCompatibility() { // workaround for reported Opera bug DSK-354448: // onclick fires on disabled buttons with opaque content From e624971e3f9fc4acec604fbcc952df689650200b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20M=C3=A4rcker?= Date: Mon, 16 Apr 2012 19:48:22 +0200 Subject: [PATCH 3/3] lint issue fixed --- web/compatibility.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/compatibility.js b/web/compatibility.js index 2a170ec37..5c192c9a9 100644 --- a/web/compatibility.js +++ b/web/compatibility.js @@ -251,4 +251,4 @@ // use browser detection since we cannot feature-check this bug document.addEventListener('click', ignoreIfTargetDisabled, true); } -})(); \ No newline at end of file +})();