diff options
| author | Igor Minar | 2011-09-21 14:10:34 +0200 |
|---|---|---|
| committer | Igor Minar | 2011-09-26 23:51:54 +0200 |
| commit | ea3228e311a22d5f917ca7135ee4d68738a6dfb4 (patch) | |
| tree | 1a4e38059d465f303ef548167a48546f1c65580e /src/scenario/Scenario.js | |
| parent | 2eb49147d69fe930714578dd7aa13f8d5e3a6d49 (diff) | |
| download | angular.js-ea3228e311a22d5f917ca7135ee4d68738a6dfb4.tar.bz2 | |
fix(scenario): workaround for FF6 dispatchEvent issue #684208
Diffstat (limited to 'src/scenario/Scenario.js')
| -rw-r--r-- | src/scenario/Scenario.js | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/scenario/Scenario.js b/src/scenario/Scenario.js index 420345f6..5ee7bde4 100644 --- a/src/scenario/Scenario.js +++ b/src/scenario/Scenario.js @@ -279,9 +279,28 @@ function browserTrigger(element, type) { } return ret; } else { - var evnt = document.createEvent('MouseEvents'); + var evnt = document.createEvent('MouseEvents'), + originalPreventDefault = evnt.preventDefault, + iframe = _jQuery('#application iframe')[0], + appWindow = iframe ? iframe.contentWindow : window, + fakeProcessDefault = true, + finalProcessDefault; + + // igor: temporary fix for https://bugzilla.mozilla.org/show_bug.cgi?id=684208 + appWindow.angular['ff-684208-preventDefault'] = false; + evnt.preventDefault = function() { + fakeProcessDefault = false; + return originalPreventDefault.apply(evnt, arguments); + }; + evnt.initMouseEvent(type, true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, element); - return element.dispatchEvent(evnt); + + element.dispatchEvent(evnt); + finalProcessDefault = !(appWindow.angular['ff-684208-preventDefault'] || !fakeProcessDefault) + + delete appWindow.angular['ff-684208-preventDefault']; + + return finalProcessDefault; } } |
