aboutsummaryrefslogtreecommitdiffstats
path: root/src/jqLite.js
diff options
context:
space:
mode:
authorIgor Minar2012-11-24 01:47:52 +0100
committerIgor Minar2012-11-26 16:03:39 +0100
commit7530654328ae508bdd05d273ba4c4e04c90744b3 (patch)
tree3a880374ec078daabaf5e0b0ae58ac7d10596e74 /src/jqLite.js
parentc7bd464384c825c75ad5f9eacd1a9ec3446deef5 (diff)
downloadangular.js-7530654328ae508bdd05d273ba4c4e04c90744b3.tar.bz2
feat(jqLite): add triggerHandler()
we need triggerHandler() to become jQuery 1.8.x compatible. this is not fully featured triggerHandler() implementation - it doesn't bother creating new DOM events and passing them into the event handlers. this is intentional, we don't need access to the native DOM event for our own purposes and creating these event objects is really tricky.
Diffstat (limited to 'src/jqLite.js')
-rw-r--r--src/jqLite.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/jqLite.js b/src/jqLite.js
index 1ba270b6..90a363f3 100644
--- a/src/jqLite.js
+++ b/src/jqLite.js
@@ -54,6 +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.
* - [unbind()](http://api.jquery.com/unbind/)
* - [val()](http://api.jquery.com/val/)
* - [wrap()](http://api.jquery.com/wrap/)
@@ -728,7 +729,15 @@ forEach({
return element.getElementsByTagName(selector);
},
- clone: JQLiteClone
+ clone: JQLiteClone,
+
+ triggerHandler: function(element, eventName) {
+ var eventFns = (JQLiteExpandoStore(element, 'events') || {})[eventName];
+
+ forEach(eventFns, function(fn) {
+ fn.call(element, null);
+ });
+ }
}, function(fn, name){
/**
* chaining functions