Skip to content

Instantly share code, notes, and snippets.

@brandonaaron
Created August 14, 2008 14:36
Show Gist options
  • Save brandonaaron/5435 to your computer and use it in GitHub Desktop.
Save brandonaaron/5435 to your computer and use it in GitHub Desktop.
// Helper method for Prototype to loop over a collection of elements
// and run a method on existing elements within the dom
Object.extend(Array.prototype, {
each_element_invoke: function(method) {
var args = $A(arguments).slice(1);
return this.map(function(element) {
return element && element[method].apply(element, args);
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment