diff options
| author | Julie | 2013-04-15 15:52:56 -0700 | 
|---|---|---|
| committer | Igor Minar | 2013-05-16 16:15:31 -0700 | 
| commit | 0401a7f598ef9a36ffe1f217e1a98961046fa551 (patch) | |
| tree | d727f4276e1993caa99e338f72385d909d5c07e0 /src | |
| parent | 6798fec4390a72b7943a49505f8a245b6016c84b (diff) | |
| download | angular.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.js | 5 | 
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){ | 
