mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-27 06:54:01 +00:00
fix(scenario): workaround for FF6 dispatchEvent issue #684208
This commit is contained in:
parent
2eb49147d6
commit
ea3228e311
2 changed files with 23 additions and 2 deletions
|
|
@ -279,9 +279,28 @@ function browserTrigger(element, type) {
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
} else {
|
} 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);
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -461,6 +461,8 @@ angularServiceInject('$location', function($browser, $sniffer, $config, $documen
|
||||||
currentUrl.url(href);
|
currentUrl.url(href);
|
||||||
scope.$apply();
|
scope.$apply();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
// hack to work around FF6 bug 684208 when scenario runner clicks on links
|
||||||
|
window.angular['ff-684208-preventDefault'] = true;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
currentUrl = new LocationHashbangUrl(initUrl, hashPrefix);
|
currentUrl = new LocationHashbangUrl(initUrl, hashPrefix);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue