Use Object.prototype.hasOwnProperty for doc in IE8

Test Plan: Loaded ballmer-peak example in IE8 without errors and interacted with the text field.
This commit is contained in:
Ben Alpert
2014-05-19 13:09:47 -07:00
parent 0c6bee049e
commit 550795445e
+3 -1
View File
@@ -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]] = {};
}