@samitouri / QOS-React-2 / commits / 550795445e

Use Object.prototype.hasOwnProperty for doc in IE8

Test Plan: Loaded ballmer-peak example in IE8 without errors and interacted with the text field.

Ben Alpert committed May 19, 2014 at 11:42 UTC 550795445e04a1b2c985ce2f58b125d0abe2817d
1 file changed +3 -1
src/browser/ReactEventEmitter.js
+3 -1
@@ -129,7 +129,9 @@ var topEventMapping = {
129 var topListenersIDKey = "_reactListenersID" + String(Math.random()).slice(2);
130
131 function getListeningForDocument(mountAt) {
132 - if (!mountAt.hasOwnProperty(topListenersIDKey)) {
132 + // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
133 + // directly.
134 + if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
135 mountAt[topListenersIDKey] = reactTopListenersCounter++;
136 alreadyListeningTo[mountAt[topListenersIDKey]] = {};
137 }