From 520a8053d49805a07bc7ed539dc5ec5ba8afd32e Mon Sep 17 00:00:00 2001 From: danjamin Date: Fri, 5 Jun 2015 19:24:43 -0700 Subject: [PATCH] Support for IE8 when document.domain is set --- es5-sham.js | 72 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 62 insertions(+), 10 deletions(-) diff --git a/es5-sham.js b/es5-sham.js index 2c6cef20..a67be3b7 100644 --- a/es5-sham.js +++ b/es5-sham.js @@ -190,6 +190,64 @@ if (!Object.create) { // the following produces false positives // in Opera Mini => not a reliable check // Object.prototype.__proto__ === null + + // Check for document.domain and active x support + // No need to use active x approach when document.domain is not set + // see https://github.com/es-shims/es5-shim/issues/150 + // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346 + /*global ActiveXObject */ + var shouldUseActiveX = function shouldUseActiveX() { + // return early if document.domain not set + if (!document.domain) { + return false; + } + + try { + return !!new ActiveXObject('htmlfile'); + } catch (exception) { + return false; + } + }; + + // This supports IE8 when document.domain is used + // see https://github.com/es-shims/es5-shim/issues/150 + // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346 + var getEmptyViaActiveX = function getEmptyViaActiveX() { + var empty; + var xDoc; + + xDoc = new ActiveXObject('htmlfile'); + + xDoc.write('