MCPcopy
hub / github.com/marcj/css-element-queries / forEachElement

Function forEachElement

src/ResizeSensor.js:52–69  ·  view source on GitHub ↗

* Iterate over each of the provided element(s). * * @param {HTMLElement|HTMLElement[]} elements * @param {Function} callback

(elements, callback)

Source from the content-addressed store, hash-verified

50 * @param {Function} callback
51 */
52 function forEachElement(elements, callback){
53 var elementsType = Object.prototype.toString.call(elements);
54 var isCollectionTyped = ('[object Array]' === elementsType
55 || ('[object NodeList]' === elementsType)
56 || ('[object HTMLCollection]' === elementsType)
57 || ('[object Object]' === elementsType)
58 || ('undefined' !== typeof jQuery && elements instanceof jQuery) //jquery
59 || ('undefined' !== typeof Elements && elements instanceof Elements) //mootools
60 );
61 var i = 0, j = elements.length;
62 if (isCollectionTyped) {
63 for (; i < j; i++) {
64 callback(elements[i]);
65 }
66 } else {
67 callback(elements);
68 }
69 }
70
71 /**
72 * Get element size

Callers 2

ResizeSensorFunction · 0.85
ResizeSensor.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected