Skip to content

Instantly share code, notes, and snippets.

@tstachl
Created October 7, 2010 02:09
Show Gist options
  • Save tstachl/614433 to your computer and use it in GitHub Desktop.
Save tstachl/614433 to your computer and use it in GitHub Desktop.
Teach mootools to clone events of children too.
Native.implement([Element, Window, Document], {
cloneEventsDeep: function(from, type){
if (this.getChildren().length > 0) {
this.getChildren().each(function(item, index) {
item.cloneEventsDeep(from.getChildren()[index], type);
});
this.cloneEvents(from, type);
} else {
this.cloneEvents(from, type);
}
return this;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment