Skip to content

Commit b4c9b1f

Browse files
committed
Fix IE8 object hashing
1 parent 9261f52 commit b4c9b1f

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

dist/Immutable.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ function hashJSObj(obj) {
164164
'writable': false,
165165
'value': hash
166166
});
167-
} else if (obj.propertyIsEnumerable === propertyIsEnumerable) {
167+
} else if (propertyIsEnumerable && obj.propertyIsEnumerable === propertyIsEnumerable) {
168168
obj.propertyIsEnumerable = function() {
169-
return Object.prototype.propertyIsEnumerable.apply(this, arguments);
169+
return propertyIsEnumerable.apply(this, arguments);
170170
};
171171
obj.propertyIsEnumerable[UID_HASH_KEY] = hash;
172172
} else if (obj.nodeType) {

dist/Immutable.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Hash.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,14 @@ function hashJSObj(obj) {
8585
'writable': false,
8686
'value': hash
8787
});
88-
} else if (obj.propertyIsEnumerable === propertyIsEnumerable) {
88+
} else if (propertyIsEnumerable &&
89+
obj.propertyIsEnumerable === propertyIsEnumerable) {
8990
// Since we can't define a non-enumerable property on the object
9091
// we'll hijack one of the less-used non-enumerable properties to
9192
// save our hash on it. Since this is a function it will not show up in
9293
// `JSON.stringify` which is what we want.
9394
obj.propertyIsEnumerable = function() {
94-
return Object.prototype.propertyIsEnumerable.apply(this, arguments);
95+
return propertyIsEnumerable.apply(this, arguments);
9596
};
9697
obj.propertyIsEnumerable[UID_HASH_KEY] = hash;
9798
} else if (obj.nodeType) {

0 commit comments

Comments
 (0)