Skip to content

Commit

Permalink
remove broken IE hack-arounds ... IE8 failing tests down to 14
Browse files Browse the repository at this point in the history
  • Loading branch information
jashkenas committed Feb 20, 2015
1 parent 194017c commit 5350a2f
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions underscore.js
Original file line number Diff line number Diff line change
Expand Up @@ -892,33 +892,13 @@
// Object Functions
// ----------------

// Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed.
var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString');
var nonEnumerableProps = ['constructor', 'valueOf', 'isPrototypeOf', 'toString',
'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];

function collectNonEnumProps(obj, keys) {
var nonEnumIdx = nonEnumerableProps.length;
var proto = typeof obj.constructor === 'function' ? FuncProto : ObjProto;

while (nonEnumIdx--) {
var prop = nonEnumerableProps[nonEnumIdx];
if (prop === 'constructor' ? _.has(obj, prop) : prop in obj &&
obj[prop] !== proto[prop] && !_.contains(keys, prop)) {
keys.push(prop);
}
}
}

// Retrieve the names of an object's own properties.
// Delegates to **ECMAScript 5**'s native `Object.keys`
_.keys = function(obj) {
if (!_.isObject(obj)) return [];
if (nativeKeys) return nativeKeys(obj);
var keys = [];
for (var key in obj) if (_.has(obj, key)) keys.push(key);
// Ahem, IE < 9.
if (hasEnumBug) collectNonEnumProps(obj, keys);
return keys;
};

Expand All @@ -927,8 +907,6 @@
if (!_.isObject(obj)) return [];
var keys = [];
for (var key in obj) keys.push(key);
// Ahem, IE < 9.
if (hasEnumBug) collectNonEnumProps(obj, keys);
return keys;
};

Expand Down

0 comments on commit 5350a2f

Please sign in to comment.