var Iterators = function() {
var tags = "div p span ul ol li span form input select textarea h1 h2 h3 h4 h5 h6 dl dt em strong";
var methods = {};
$A(tags.split(' ')).each(function(tag) {
methods["each" + tag.charAt(0).toUpperCase() + tag.substring(1)] = function(element, iterator) {
element = $(element);
element.cleanWhitespace();
$A(element.getElementsByTagName(tag)).each(iterator);
}
});
Element.addMethods(methods);
}();
Writing Custom Iterators For Prototype
No comments:
Post a Comment