aboutsummaryrefslogtreecommitdiffstats
path: root/src/jqLite.js
diff options
context:
space:
mode:
authorIgor Minar2011-09-15 21:20:38 +0200
committerIgor Minar2011-09-16 02:44:29 +0200
commit6b7ddf414de82720bbf547b2fa661bf5fcec7bb6 (patch)
tree009ad32aac321ee7965d3df0350fb9dfa104e25b /src/jqLite.js
parent8259f101389afc1b5b1f044b2b07bf6f8f44fc83 (diff)
downloadangular.js-6b7ddf414de82720bbf547b2fa661bf5fcec7bb6.tar.bz2
feat(jqLite): add support for unbind()
supports these invocation types: - foo.unbind(); - foo.unbind('eventType'); - foo.unbind('eventType', fn); more info: http://api.jquery.com/unbind/
Diffstat (limited to 'src/jqLite.js')
-rw-r--r--src/jqLite.js22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/jqLite.js b/src/jqLite.js
index 67b6137d..d255845e 100644
--- a/src/jqLite.js
+++ b/src/jqLite.js
@@ -37,6 +37,7 @@
* - [clone()](http://api.jquery.com/clone/)
* - [css()](http://api.jquery.com/css/)
* - [data()](http://api.jquery.com/data/)
+ * - [eq()](http://api.jquery.com/eq/)
* - [hasClass()](http://api.jquery.com/hasClass/)
* - [parent()](http://api.jquery.com/parent/)
* - [remove()](http://api.jquery.com/remove/)
@@ -46,7 +47,7 @@
* - [replaceWith()](http://api.jquery.com/replaceWith/)
* - [text()](http://api.jquery.com/text/)
* - [trigger()](http://api.jquery.com/trigger/)
- * - [eq()](http://api.jquery.com/eq/)
+ * - [unbind()](http://api.jquery.com/unbind/)
*
* ## In addtion to the above, Angular privides an additional method to both jQuery and jQuery lite:
*
@@ -401,6 +402,25 @@ forEach({
});
},
+ unbind: function(element, type, fn) {
+ var bind = JQLiteData(element, 'bind');
+ if (!bind) return; //no listeners registered
+
+ if (isUndefined(type)) {
+ forEach(bind, function(eventHandler, type) {
+ removeEventListenerFn(element, type, eventHandler);
+ delete bind[type];
+ });
+ } else {
+ if (isUndefined(fn)) {
+ removeEventListenerFn(element, type, bind[type]);
+ delete bind[type];
+ } else {
+ angularArray.remove(bind[type].fns, fn);
+ }
+ }
+ },
+
replaceWith: function(element, replaceNode) {
var index, parent = element.parentNode;
JQLiteDealoc(element);