Bug 784126 - Fix JSDOMParser textContent setter. r=lucasr
authorBrian Nicholson <bnicholson@mozilla.com>
Wed, 22 Aug 2012 10:15:46 -0700
changeset 105075 fcb1cb11935f91aa0778837f98235123e5422ca0
parent 105074 91cba558c70c3a08699ba5c4958239f2c77f6d33
child 105076 e97800e74b636eb088edd68ee219a8a30c7dc9b3
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
reviewerslucasr
bugs784126
milestone17.0a1
Bug 784126 - Fix JSDOMParser textContent setter. r=lucasr
mobile/android/chrome/content/JSDOMParser.js
--- a/mobile/android/chrome/content/JSDOMParser.js
+++ b/mobile/android/chrome/content/JSDOMParser.js
@@ -491,17 +491,22 @@
         this.childNodes[i].parentNode = null;
       }
       this.childNodes = node.childNodes;
       for (let i = this.childNodes.length; --i >= 0;) {
         this.childNodes[i].parentNode = this;
       }
     },
 
-    set textContext(text) {
+    set textContent(text) {
+      // clear parentNodes for existing children
+      for (let i = this.childNodes.length; --i >= 0;) {
+        this.childNodes[i].parentNode = null;
+      }
+
       let node = new Text();
       this.childNodes = [ node ];
       node.textContent = text;
       node.parentNode = this;
     },
 
     get textContent() {
       let text = "";