diff --git a/source/Ox/js/DOM.js b/source/Ox/js/DOM.js index 7acb6c18..f60befa5 100644 --- a/source/Ox/js/DOM.js +++ b/source/Ox/js/DOM.js @@ -146,6 +146,16 @@ Ox.$ = Ox.element = function(val) { }); return this; }, + bindOnce: function(events) { + var that = this; + Ox.forEach(Ox.makeObject(arguments), function(callback, event) { + that[0]['on' + event] = function() { + that.unbind(event); + callback(); + }; + }); + return this; + }, /*@ click Binds a function to the click event (callback) -> This element @@ -214,6 +224,10 @@ Ox.$ = Ox.element = function(val) { this[0].onmousedown = callback; return this; }, + remove: function() { + this[0].parentNode.removeChild(this[0]); + return this; + }, /*@ removeAttr Removes an attribute (key) -> This element @@ -237,7 +251,7 @@ Ox.$ = Ox.element = function(val) { return this; }, unbind: function(event) { - delete this[0]['on' + event]; + this[0]['on' + event] = null; return this; } } : null;