MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / byClassName

Function byClassName

lib/web/CodeMirror/test/test.js:16–27  ·  view source on GitHub ↗
(elt, cls)

Source from the content-addressed store, hash-verified

14}
15
16function byClassName(elt, cls) {
17 if (elt.getElementsByClassName) return elt.getElementsByClassName(cls);
18 var found = [], re = new RegExp("\\b" + cls + "\\b");
19 function search(elt) {
20 if (elt.nodeType == 3) return;
21 if (re.test(elt.className)) found.push(elt);
22 for (var i = 0, e = elt.childNodes.length; i < e; ++i)
23 search(elt.childNodes[i]);
24 }
25 search(elt);
26 return found;
27}
28
29var ie_lt8 = /MSIE [1-7]\b/.test(navigator.userAgent);
30var ie_lt9 = /MSIE [1-8]\b/.test(navigator.userAgent);

Callers 4

barHFunction · 0.85
barVFunction · 0.85
test.jsFile · 0.85

Calls 1

searchFunction · 0.85

Tested by

no test coverage detected