Skip to content

Commit 5127e93

Browse files
Fix for proper handling of native node lists
Proper handling for NodeList and HTMLCollection objects
1 parent 7f0d78c commit 5127e93

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/ResizeSensor.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,11 @@
125125
addEvent(expand, 'scroll', onScroll);
126126
addEvent(shrink, 'scroll', onScroll);
127127
}
128-
129-
if ("[object Array]" === Object.prototype.toString.call(element)
128+
129+
var elementType = Object.prototype.toString.call(element);
130+
if ('[object Array]' === elementType
131+
|| ('[object NodeList]' === elementTyle)
132+
|| ('[object HTMLCollection]' === elementTyle)
130133
|| ('undefined' !== typeof jQuery && element instanceof jQuery) //jquery
131134
|| ('undefined' !== typeof Elements && element instanceof Elements) //mootools
132135
) {
@@ -151,4 +154,4 @@
151154
}
152155
};
153156

154-
})();
157+
})();

0 commit comments

Comments
 (0)