aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJulie2013-04-15 15:52:56 -0700
committerIgor Minar2013-05-16 16:15:31 -0700
commit0401a7f598ef9a36ffe1f217e1a98961046fa551 (patch)
treed727f4276e1993caa99e338f72385d909d5c07e0 /src
parent6798fec4390a72b7943a49505f8a245b6016c84b (diff)
downloadangular.js-0401a7f598ef9a36ffe1f217e1a98961046fa551.tar.bz2
fix(jqLite): pass a dummy event into triggerHandler
Previously, anchor elements could not be used with triggerHandler because triggerHandler passes null as the event, and any anchor element with an empty href automatically calls event.preventDefault(). Instead, pass a dummy event when using triggerHandler, similar to what full jQuery does. Modified from PR #2379.
Diffstat (limited to 'src')
-rw-r--r--src/jqLite.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/jqLite.js b/src/jqLite.js
index 958242cd..6809da74 100644
--- a/src/jqLite.js
+++ b/src/jqLite.js
@@ -54,7 +54,7 @@
* - [replaceWith()](http://api.jquery.com/replaceWith/)
* - [text()](http://api.jquery.com/text/)
* - [toggleClass()](http://api.jquery.com/toggleClass/)
- * - [triggerHandler()](http://api.jquery.com/triggerHandler/) - Doesn't pass native event objects to handlers.
+ * - [triggerHandler()](http://api.jquery.com/triggerHandler/) - Passes a dummy event object to handlers.
* - [unbind()](http://api.jquery.com/unbind/) - Does not support namespaces
* - [val()](http://api.jquery.com/val/)
* - [wrap()](http://api.jquery.com/wrap/)
@@ -763,9 +763,10 @@ forEach({
triggerHandler: function(element, eventName) {
var eventFns = (JQLiteExpandoStore(element, 'events') || {})[eventName];
+ var event;
forEach(eventFns, function(fn) {
- fn.call(element, null);
+ fn.call(element, {preventDefault: noop});
});
}
}, function(fn, name){