Created
May 2, 2018 09:12
-
-
Save jung-han/336d5b4760fa0eccb5b5c38c84382819 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
getNodesHavingClassName: function(nodes, className) { | |
var i, | |
tagIndex, | |
resultNodes = [], | |
classList = []; | |
for (i = 0; i < nodes.length; i += 1) { | |
classList = nodes[i].className; | |
classList = classList.length === 0 ? [] : classList.split(' '); | |
if (!Array.prototype.indexOf) { | |
tagIndex = arrayutil.indexOf(classList, className); | |
} else { | |
tagIndex = classList.indexOf(className); | |
} | |
if (tagIndex !== -1) { | |
resultNodes.push(nodes[i]); | |
} | |
} | |
return resultNodes; | |
}, | |
getNodesHavingId: function(nodes, id) { | |
return id; | |
}, | |
getNodesHavingTagName: function(nodes, tagName) { | |
return tagName; | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment