From eebad166367d85ff61846961a332030c6c81b4f5 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Mon, 25 Nov 2013 15:05:35 -0500 Subject: [PATCH] =?UTF-8?q?Use=20an=20iframe=20to=20create=20a=20testDocum?= =?UTF-8?q?ent=E2=80=A6=20instead=20of=20`createHTMLDocument`=20since=20it?= =?UTF-8?q?=20isn't=20fully=20support=20by=20the=20browsers=20we=20care=20?= =?UTF-8?q?about.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes #606 fixes #454 --- src/test/getTestDocument.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/test/getTestDocument.js b/src/test/getTestDocument.js index 9d30b6df57..b0f21ef7cf 100644 --- a/src/test/getTestDocument.js +++ b/src/test/getTestDocument.js @@ -23,11 +23,13 @@ * (jst). */ function getTestDocument() { - if (document.implementation && - document.implementation.createHTMLDocument) { - return document.implementation.createHTMLDocument('test doc'); - } - return null; + var iframe = document.createElement('iframe'); + iframe.style.cssText = 'position:absolute; visibility:hidden; bottom:100%; right:100%'; + iframe.src = 'data:text/html,test doc'; + document.body.appendChild(iframe); + var testDocument = iframe.contentDocument; + iframe.parentNode.removeChild(iframe); + return testDocument; } module.exports = getTestDocument;