Commit 0aecffda authored by Julien Cigar's avatar Julien Cigar
Browse files

added Yeti.DOM.firstElementTag

parent c64814b7
......@@ -492,6 +492,21 @@
})(name, src);
}
/* Yeti.DOM.firstElementTag
* Returns a reference to the first child node of that element which is of
* nodeType 1 and of tag <tag>.
*/
Yeti.DOM.firstElementTag = function(elem, tag) {
var tag = tag.toUpperCase();
for (var i=0, _len=elem.childNodes.length; i<_len; i++) {
if (elem.childNodes[i].nodeType === 1 &&
elem.nodeName.toUpperCase() == tag) {
return elem.childNodes[i];
}
}
return null;
}
/* Yeti.DOM.removeNodes
* Removes all child nodes from an element.
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment