From 2642d5aa9252dfa76fe2708c2a65a87d37199bfc Mon Sep 17 00:00:00 2001 From: Deathamns Date: Wed, 11 Feb 2015 17:49:50 +0100 Subject: [PATCH] replacing documentElement is enough --- src/js/element-picker.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/js/element-picker.js b/src/js/element-picker.js index 81ce4606a..db763964e 100644 --- a/src/js/element-picker.js +++ b/src/js/element-picker.js @@ -690,21 +690,17 @@ var stopPicker = function() { /******************************************************************************/ var startPicker = function(details) { + pickerRoot.onload = stopPicker; + var frameDoc = pickerRoot.contentDocument; var parsedDom = (new DOMParser()).parseFromString( details.frameContent, 'text/html' ); - pickerRoot.onload = stopPicker; - - frameDoc.documentElement.replaceChild( - frameDoc.adoptNode(parsedDom.head), - frameDoc.head - ); - frameDoc.documentElement.replaceChild( - frameDoc.adoptNode(parsedDom.body), - frameDoc.body + frameDoc.replaceChild( + frameDoc.adoptNode(parsedDom.documentElement), + frameDoc.documentElement ); frameDoc.body.setAttribute('lang', navigator.language);