Created
April 26, 2010 23:15
-
-
Save irae/380077 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Some simple functions to find elements. | |
var id = function(id){return document.getElementById(id)}, | |
tag = function(tag,scope){return (scope||document).getElementsByTagName(tag)}, | |
hasClass = function(find,nodes) { | |
var ret = [],node,i; for(i=0;i<nodes.length;i++) { node = nodes[i]; | |
if(1+node.className.indexOf(find)) { ret.push(node);} | |
} return ret; | |
}; | |
// usage | |
var messages = hasClass('message', | |
tag('div', | |
id('commit') | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment