From 550795445e04a1b2c985ce2f58b125d0abe2817d Mon Sep 17 00:00:00 2001 From: Ben Alpert Date: Mon, 19 May 2014 11:42:37 -0700 Subject: [PATCH] Use Object.prototype.hasOwnProperty for doc in IE8 Test Plan: Loaded ballmer-peak example in IE8 without errors and interacted with the text field. --- src/browser/ReactEventEmitter.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/browser/ReactEventEmitter.js b/src/browser/ReactEventEmitter.js index 5481c2e9b8..5f1956d7d9 100644 --- a/src/browser/ReactEventEmitter.js +++ b/src/browser/ReactEventEmitter.js @@ -129,7 +129,9 @@ var topEventMapping = { var topListenersIDKey = "_reactListenersID" + String(Math.random()).slice(2); function getListeningForDocument(mountAt) { - if (!mountAt.hasOwnProperty(topListenersIDKey)) { + // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty` + // directly. + if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) { mountAt[topListenersIDKey] = reactTopListenersCounter++; alreadyListeningTo[mountAt[topListenersIDKey]] = {}; }