Skip to content

Instantly share code, notes, and snippets.

@ezhlobo
Created February 27, 2013 19:34
Show Gist options
  • Save ezhlobo/5050929 to your computer and use it in GitHub Desktop.
Save ezhlobo/5050929 to your computer and use it in GitHub Desktop.
Hata extensions
(function( hata ) {
hata.extend({
bind: function( eventType, callback ) {
return this.each(function() {
this.addEventListener( eventType, callback, false );
});
},
unbind: function( eventType, callback ) {
if ( callback ) {
return this.each(function() {
this.removeEventListener( eventType, callback );
});
} else {
return this.each(function() {
this.parentNode.replaceChild( this.cloneNode(true), this );
});
}
}
});
}( hata ));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment