From 839915a3872dc95d148917338d5812430a6cb249 Mon Sep 17 00:00:00 2001 From: mario Date: Wed, 16 Apr 2014 13:14:13 +0200 Subject: [PATCH] see #22 Fixed an IE9 related problem --- purify.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/purify.js b/purify.js index 6f357e5ad..61b68e02f 100644 --- a/purify.js +++ b/purify.js @@ -176,7 +176,12 @@ /* Cover IE9's buggy outerHTML behavior */ if(dom.body === null) { + dom = document.implementation.createHTMLDocument(''); dom.body.innerHTML = dirty; + if(dom.body.firstChild.nodeName && !WHOLE_DOCUMENT + && dom.body.firstChild.nodeName === 'STYLE'){ + dom.body.removeChild(dom.body.firstChild); + } } /* Work on whole document or just its body */