Skip to content

Instantly share code, notes, and snippets.

@RenatoUtsch
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RenatoUtsch/0a94b94ff3eb1994e375 to your computer and use it in GitHub Desktop.
Save RenatoUtsch/0a94b94ff3eb1994e375 to your computer and use it in GitHub Desktop.
/**
* Calls the functions from the behaviors in order and then the function
* from the element, if it exists.
*/
_inheritanceCall: function(name) {
var args = arguments.slice(1);
for(b in this.behaviors) {
b[name].apply(this, args);
}
// Call the one from the element also, if it exists.
if(this[name] != this.behaviors[this.behaviors.length - 1][name])
this[name].apply(this, args);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment