mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 17:07:49 +00:00
Add support for NodeLists in _.toArray for IE < 9.
Former-commit-id: 67b26fe6fe60d77c0b38c48865bfd2ca56f7b470
This commit is contained in:
13
test/test.js
13
test/test.js
@@ -1782,6 +1782,19 @@
|
||||
deepEqual(_.toArray('abc'), ['a', 'b', 'c']);
|
||||
deepEqual(_.toArray(Object('abc')), ['a', 'b', 'c']);
|
||||
});
|
||||
|
||||
test('should work with a NodeList for `collection` (test in IE < 9)', function() {
|
||||
if (window.document) {
|
||||
try {
|
||||
var nodeList = document.getElementsByTagName('body'),
|
||||
body = nodeList[0],
|
||||
actual = _.toArray(nodeList);
|
||||
} catch(e) { }
|
||||
deepEqual(actual, [body]);
|
||||
} else {
|
||||
skipTest();
|
||||
}
|
||||
});
|
||||
}(1, 2, 3));
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user