Last active
December 16, 2015 06:59
-
-
Save caisui/5395518 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/common/content/util.js b/common/content/util.js | |
--- a/common/content/util.js | |
+++ b/common/content/util.js | |
@@ -782,12 +782,12 @@ | |
* @see util.xmlToDom | |
*/ | |
xmlToDomForTemplate: function xmlToDomForTemplate(node, doc, nodes) { | |
- var dom = doc.createDocumentFragment(); | |
var range = doc.createRange(); | |
var fragment = range.createContextualFragment( | |
xml`<div xmlns:ns=${NS} xmlns:xul=${XUL} xmlns=${XHTML}>${node}</div>`.toString()); | |
- while (fragment.firstChild.childNodes.length > 0) | |
- dom.appendChild(fragment.firstChild.firstChild) | |
+ | |
+ range.selectNodeContents(fragment.firstChild); | |
+ var dom = range.extractContents(); | |
range.detach(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
付けました。