Skip to content

Commit da103c2

Browse files
committed
Improved array detection
1 parent 9706311 commit da103c2

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

knockout-paging.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,16 @@
2121
// --------
2222
"use strict";
2323

24+
// polyfill for IE < 9
25+
if (!Array.isArray) {
26+
Array.isArray = function(arg) {
27+
return Object.prototype.toString.call(arg) === '[object Array]';
28+
};
29+
}
30+
2431
// Utilities
2532
function isObservableArray(value) {
26-
return ko.isObservable(value) && 'push' in ko.unwrap(value);
33+
return ko.isObservable(value) && Array.isArray(ko.unwrap(value));
2734
}
2835

2936
function createRange(min, max) {

0 commit comments

Comments
 (0)