[Shadow DOM] registering InsertionPoints to ShadowRoot should work out of a document.
authorshinyak@chromium.org <shinyak@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Dec 2012 07:22:34 +0000 (07:22 +0000)
committershinyak@chromium.org <shinyak@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Dec 2012 07:22:34 +0000 (07:22 +0000)
https://bugs.webkit.org/show_bug.cgi?id=104346

Reviewed by Hajime Morita.

Source/WebCore:

We need to register InsertionPoints even if ShadowRoot is out of Document, since distribution should work
out of Document, too.

Instead of checking isInDocument(), we have to make sure InsertionPoint and an element which InsertionPoint
inserted into have the same treescope.

Tests: fast/dom/shadow/has-content-elements.html
       fast/dom/shadow/has-shadow-insertion-point.html

* html/shadow/InsertionPoint.cpp:
(WebCore::InsertionPoint::insertedInto):
(WebCore::InsertionPoint::removedFrom):

LayoutTests:

Added tests for out-of-Document version and calling insertedInto/removedFrom several times.

* fast/dom/shadow/has-content-elements-expected.txt:
* fast/dom/shadow/has-content-elements.html:
* fast/dom/shadow/has-shadow-insertion-point-expected.txt:
* fast/dom/shadow/has-shadow-insertion-point.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@137421 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/dom/shadow/has-content-elements-expected.txt
LayoutTests/fast/dom/shadow/has-content-elements.html
LayoutTests/fast/dom/shadow/has-shadow-insertion-point-expected.txt
LayoutTests/fast/dom/shadow/has-shadow-insertion-point.html
Source/WebCore/ChangeLog
Source/WebCore/html/shadow/InsertionPoint.cpp

index 4cd3b85..53b58d8 100644 (file)
@@ -1,3 +1,17 @@
+2012-12-11  Shinya Kawanaka  <shinyak@chromium.org>
+
+        [Shadow DOM] registering InsertionPoints to ShadowRoot should work out of a document.
+        https://bugs.webkit.org/show_bug.cgi?id=104346
+
+        Reviewed by Hajime Morita.
+
+        Added tests for out-of-Document version and calling insertedInto/removedFrom several times.
+
+        * fast/dom/shadow/has-content-elements-expected.txt:
+        * fast/dom/shadow/has-content-elements.html:
+        * fast/dom/shadow/has-shadow-insertion-point-expected.txt:
+        * fast/dom/shadow/has-shadow-insertion-point.html:
+
 2012-12-11  Takashi Sakamoto  <tasak@google.com>
 
         Text nodes in shadow roots don't inherit style properly
index 7340737..d26a998 100644 (file)
@@ -1,5 +1,6 @@
-Test for Bug 100921: https://bugs.webkit.org/show_bug.cgi?id=100921 - [Shadow] ShadowRoot should be able to know the existence of <content>
+Test for Bug 100921 and 104346: HTMLContentElement should be registered correctly.
 
+In the case host is in document
 PASS internals.hasContentElement(shadowRoot) is false
 PASS internals.hasContentElement(shadowRoot) is true
 PASS internals.hasContentElement(shadowRoot) is false
@@ -17,6 +18,30 @@ PASS internals.hasContentElement(shadowRoot) is false
 PASS internals.hasContentElement(youngerShadowRoot) is false
 PASS internals.hasContentElement(shadowRoot) is false
 PASS internals.hasContentElement(youngerShadowRoot) is true
+In the case host is not in document
+PASS internals.hasContentElement(shadowRoot) is false
+PASS internals.hasContentElement(shadowRoot) is true
+PASS internals.hasContentElement(shadowRoot) is false
+PASS internals.hasContentElement(shadowRoot) is false
+PASS internals.hasContentElement(shadowRoot) is true
+PASS internals.hasContentElement(shadowRoot) is false
+PASS internals.hasContentElement(shadowRoot) is true
+PASS internals.hasContentElement(shadowRoot) is false
+PASS internals.hasContentElement(innerShadowRoot1) is true
+PASS internals.hasContentElement(innerShadowRoot2) is true
+PASS internals.hasContentElement(shadowRoot) is false
+PASS internals.hasContentElement(shadowRoot) is true
+PASS internals.hasContentElement(youngerShadowRoot) is false
+PASS internals.hasContentElement(shadowRoot) is false
+PASS internals.hasContentElement(youngerShadowRoot) is false
+PASS internals.hasContentElement(shadowRoot) is false
+PASS internals.hasContentElement(youngerShadowRoot) is true
+insertedInto/removedFrom can be called several times.
+PASS internals.hasContentElement(shadowRoot) is false
+PASS internals.hasContentElement(shadowRoot) is true
+PASS internals.hasContentElement(shadowRoot) is true
+PASS internals.hasContentElement(shadowRoot) is true
+PASS internals.hasContentElement(shadowRoot) is false
 PASS successfullyParsed is true
 
 TEST COMPLETE
index 90d62bc..256dae9 100644 (file)
@@ -12,66 +12,98 @@ else if (!window.internals.hasContentElement)
 </head>
 <body>
 
-<p>Test for Bug 100921: <a href="https://bugs.webkit.org/show_bug.cgi?id=100921">https://bugs.webkit.org/show_bug.cgi?id=100921</a> - [Shadow] ShadowRoot should be able to know the existence of &lt;content&gt;</p>
+<p>Test for Bug <a href="https://bugs.webkit.org/show_bug.cgi?id=100921">100921</a> and <a href="https://bugs.webkit.org/show_bug.cgi?id=104346">104346</a>: HTMLContentElement should be registered correctly.</p>
 
-<div id="host"></div>
+<div id="wrapper"></div>
 <pre id="console"></pre>
 
 <script>
-var host = document.getElementById("host");
+function doCommonTest() {
+    shouldBeFalse("internals.hasContentElement(shadowRoot)");
+
+    var div = document.createElement("div");
+    div.appendChild(document.createElement("content"));
+    shadowRoot.appendChild(div);
+    shouldBeTrue("internals.hasContentElement(shadowRoot)");
+    
+    shadowRoot.removeChild(div);
+    shouldBeFalse("internals.hasContentElement(shadowRoot)");
+    
+    shadowRoot.innerHTML = "<div>No Insertion Points</div>";
+    shouldBeFalse("internals.hasContentElement(shadowRoot)");
+    
+    shadowRoot.innerHTML = "<content></content>";
+    shouldBeTrue("internals.hasContentElement(shadowRoot)");
+    
+    shadowRoot.innerHTML = "<shadow></shadow>";
+    shouldBeFalse("internals.hasContentElement(shadowRoot)");
+    
+    shadowRoot.innerHTML = "<div><div><div><content></content></div></div></div>";
+    shouldBeTrue("internals.hasContentElement(shadowRoot)");
+    
+    // Case for nested shadow subtree
+    shadowRoot.innerHTML = '<div>in shadow root</div>';
+    var innerDiv1 = shadowRoot.querySelector('div');
+    innerShadowRoot1 = innerDiv1.webkitCreateShadowRoot();
+    innerShadowRoot1.innerHTML = "<div><content></content></div>";
+    var innerDiv2 = innerShadowRoot1.querySelector('div');
+    innerShadowRoot2 = innerDiv2.webkitCreateShadowRoot();
+    innerShadowRoot2.innerHTML = "<div><content title='debugstop'></content></div>";
+    
+    shouldBeFalse("internals.hasContentElement(shadowRoot)");
+    shouldBeTrue("internals.hasContentElement(innerShadowRoot1)");
+    shouldBeTrue("internals.hasContentElement(innerShadowRoot2)");
+    shadowRoot.innerHTML = "<div></div>";
+    shouldBeFalse("internals.hasContentElement(shadowRoot)");
+
+    // Case for multiple shadow subtrees
+    shadowRoot.innerHTML = "<div><div><div><content></content></div></div></div>";
+    youngerShadowRoot = host.webkitCreateShadowRoot();
+    // Modifying older shadow root or younger shadow root doesn't affect the other.
+    shouldBeTrue("internals.hasContentElement(shadowRoot)");
+    shouldBeFalse("internals.hasContentElement(youngerShadowRoot)");
+    
+    shadowRoot.innerHTML = "<shadow></shadow>";
+    shouldBeFalse("internals.hasContentElement(shadowRoot)");
+    shouldBeFalse("internals.hasContentElement(youngerShadowRoot)");
+    
+    youngerShadowRoot.innerHTML = "<content></content>";
+    shouldBeFalse("internals.hasContentElement(shadowRoot)");
+    shouldBeTrue("internals.hasContentElement(youngerShadowRoot)");
+}
+
+debug('In the case host is in document');
+host = document.createElement('div');
+wrapper.appendChild(host);
+shadowRoot = host.webkitCreateShadowRoot();
+doCommonTest();
+wrapper.innerHTML = "";
+
+debug('In the case host is not in document');
+host = document.createElement('div');
+shadowRoot = host.webkitCreateShadowRoot();
+doCommonTest();
+wrapper.innerHTML = "";
+
+debug('insertedInto/removedFrom can be called several times.');
+var host = document.createElement('div');
+var content = document.createElement('content');
+var div1 = document.createElement('div');
+var div2 = document.createElement('div');
 var shadowRoot = host.webkitCreateShadowRoot();
-
-shouldBeFalse("internals.hasContentElement(shadowRoot)");
-
-var div = document.createElement("div");
-div.appendChild(document.createElement("content"));
-shadowRoot.appendChild(div);
-shouldBeTrue("internals.hasContentElement(shadowRoot)");
-
-shadowRoot.removeChild(div);
-shouldBeFalse("internals.hasContentElement(shadowRoot)");
-
-shadowRoot.innerHTML = "<div>No Insertion Points</div>";
-shouldBeFalse("internals.hasContentElement(shadowRoot)");
-
-shadowRoot.innerHTML = "<content></content>";
-shouldBeTrue("internals.hasContentElement(shadowRoot)");
-
-shadowRoot.innerHTML = "<shadow></shadow>";
-shouldBeFalse("internals.hasContentElement(shadowRoot)");
-
-shadowRoot.innerHTML = "<div><div><div><content></content></div></div></div>";
-shouldBeTrue("internals.hasContentElement(shadowRoot)");
-
-// Case for nested shadow subtree
-shadowRoot.innerHTML = '<div>in shadow root</div>';
-var innerDiv1 = shadowRoot.querySelector('div');
-var innerShadowRoot1 = innerDiv1.webkitCreateShadowRoot();
-innerShadowRoot1.innerHTML = "<div><content></content></div>";
-var innerDiv2 = innerShadowRoot1.querySelector('div');
-var innerShadowRoot2 = innerDiv2.webkitCreateShadowRoot();
-innerShadowRoot2.innerHTML = "<div><content title='debugstop'></content></div>";
-
-shouldBeFalse("internals.hasContentElement(shadowRoot)");
-shouldBeTrue("internals.hasContentElement(innerShadowRoot1)");
-shouldBeTrue("internals.hasContentElement(innerShadowRoot2)");
-shadowRoot.innerHTML = "<div></div>";
-shouldBeFalse("internals.hasContentElement(shadowRoot)");
-
-// Case for multiple shadow subtrees
-shadowRoot.innerHTML = "<div><div><div><content></content></div></div></div>";
-var youngerShadowRoot = host.webkitCreateShadowRoot();
-// Modifying older shadow root or younger shadow root doesn't affect the other.
-shouldBeTrue("internals.hasContentElement(shadowRoot)");
-shouldBeFalse("internals.hasContentElement(youngerShadowRoot)");
-
-shadowRoot.innerHTML = "<shadow></shadow>";
-shouldBeFalse("internals.hasContentElement(shadowRoot)");
-shouldBeFalse("internals.hasContentElement(youngerShadowRoot)");
-
-youngerShadowRoot.innerHTML = "<content></content>";
-shouldBeFalse("internals.hasContentElement(shadowRoot)");
-shouldBeTrue("internals.hasContentElement(youngerShadowRoot)");
+div1.appendChild(content);
+shouldBeFalse('internals.hasContentElement(shadowRoot)');
+shadowRoot.appendChild(div1);
+shouldBeTrue('internals.hasContentElement(shadowRoot)');
+div2.appendChild(host);
+shouldBeTrue('internals.hasContentElement(shadowRoot)');
+div2.removeChild(host);
+shouldBeTrue('internals.hasContentElement(shadowRoot)');
+shadowRoot.removeChild(div1);
+shouldBeFalse('internals.hasContentElement(shadowRoot)');
+div1.removeChild(content);
+
+wrapper.innerHTML = '';
 </script>
 <script src="../../js/resources/js-test-post.js"></script>
 </body>
index dc4a16b..d68d90a 100644 (file)
@@ -1,3 +1,6 @@
+Test for Bug 97184 and 104346 : HTMLShadowElement should be registered correctly.
+
+In the case host is in document
 PASS internals.hasShadowInsertionPoint(shadowRoot) is false
 PASS internals.hasShadowInsertionPoint(shadowRoot) is true
 PASS internals.hasShadowInsertionPoint(shadowRoot) is false
@@ -11,8 +14,27 @@ PASS internals.hasShadowInsertionPoint(shadowRoot) is false
 PASS internals.hasShadowInsertionPoint(youngerShadowRoot) is false
 PASS internals.hasShadowInsertionPoint(shadowRoot) is false
 PASS internals.hasShadowInsertionPoint(youngerShadowRoot) is true
+In the case host is not in document
+PASS internals.hasShadowInsertionPoint(shadowRoot) is false
+PASS internals.hasShadowInsertionPoint(shadowRoot) is true
+PASS internals.hasShadowInsertionPoint(shadowRoot) is false
+PASS internals.hasShadowInsertionPoint(shadowRoot) is false
+PASS internals.hasShadowInsertionPoint(shadowRoot) is false
+PASS internals.hasShadowInsertionPoint(shadowRoot) is true
+PASS internals.hasShadowInsertionPoint(shadowRoot) is true
+PASS internals.hasShadowInsertionPoint(shadowRoot) is true
+PASS internals.hasShadowInsertionPoint(youngerShadowRoot) is false
+PASS internals.hasShadowInsertionPoint(shadowRoot) is false
+PASS internals.hasShadowInsertionPoint(youngerShadowRoot) is false
+PASS internals.hasShadowInsertionPoint(shadowRoot) is false
+PASS internals.hasShadowInsertionPoint(youngerShadowRoot) is true
+insertedInto/removedFrom can be called several times.
+PASS internals.hasShadowInsertionPoint(shadowRoot) is false
+PASS internals.hasShadowInsertionPoint(shadowRoot) is true
+PASS internals.hasShadowInsertionPoint(shadowRoot) is true
+PASS internals.hasShadowInsertionPoint(shadowRoot) is true
+PASS internals.hasShadowInsertionPoint(shadowRoot) is false
 PASS successfullyParsed is true
 
 TEST COMPLETE
-Test for Bug 97184: https://bugs.webkit.org/show_bug.cgi?id=97184 - [Shadow] ShadowRoot should know whether <shadow> in its treescope
 
index d6c8ce4..7b66aa5 100644 (file)
@@ -11,49 +11,81 @@ else if (!window.internals.hasShadowInsertionPoint)
 </script>
 </head>
 <body>
-  <span>Test for Bug 97184: <a href="https://bugs.webkit.org/show_bug.cgi?id=97184">https://bugs.webkit.org/show_bug.cgi?id=97184</a> -
-    [Shadow] ShadowRoot should know whether &lt;shadow&gt; in its treescope
-  </span>
-  <div id="host"></div>
+
+<p>Test for Bug <a href="https://bugs.webkit.org/show_bug.cgi?id=97184">97184</a> and <a href="https://bugs.webkit.org/show_bug.cgi?id=104346">104346</a> : HTMLShadowElement should be registered correctly.</p>
+
+<div id="wrapper"></div>
+<pre id="console"></pre>
 
 <script>
-var host = document.getElementById("host");
-var shadowRoot = host.webkitCreateShadowRoot();
+function doTest() {
+    shouldBeFalse("internals.hasShadowInsertionPoint(shadowRoot)");
+
+    var div = document.createElement("div");
+    div.appendChild(document.createElement("shadow"));
+    shadowRoot.appendChild(div);
+    shouldBeTrue("internals.hasShadowInsertionPoint(shadowRoot)");
 
-shouldBeFalse("internals.hasShadowInsertionPoint(shadowRoot)");
+    shadowRoot.removeChild(div);
+    shouldBeFalse("internals.hasShadowInsertionPoint(shadowRoot)");
 
-var div = document.createElement("div");
-div.appendChild(document.createElement("shadow"));
-shadowRoot.appendChild(div);
-shouldBeTrue("internals.hasShadowInsertionPoint(shadowRoot)");
+    shadowRoot.innerHTML = "<div>No Insertion Points</div>";
+    shouldBeFalse("internals.hasShadowInsertionPoint(shadowRoot)");
 
-shadowRoot.removeChild(div);
-shouldBeFalse("internals.hasShadowInsertionPoint(shadowRoot)");
+    shadowRoot.innerHTML = "<content></content>";
+    shouldBeFalse("internals.hasShadowInsertionPoint(shadowRoot)");
 
-shadowRoot.innerHTML = "<div>No Insertion Points</div>";
-shouldBeFalse("internals.hasShadowInsertionPoint(shadowRoot)");
+    shadowRoot.innerHTML = "<shadow></shadow>";
+    shouldBeTrue("internals.hasShadowInsertionPoint(shadowRoot)");
 
-shadowRoot.innerHTML = "<content></content>";
-shouldBeFalse("internals.hasShadowInsertionPoint(shadowRoot)");
+    shadowRoot.innerHTML = "<div><div><div><shadow></shadow></div></div></div>";
+    shouldBeTrue("internals.hasShadowInsertionPoint(shadowRoot)");
 
-shadowRoot.innerHTML = "<shadow></shadow>";
-shouldBeTrue("internals.hasShadowInsertionPoint(shadowRoot)");
+    youngerShadowRoot = host.webkitCreateShadowRoot(host);
+    // Modifying older shadow root or younger shadow root doesn't affect the other.
+    shouldBeTrue("internals.hasShadowInsertionPoint(shadowRoot)");
+    shouldBeFalse("internals.hasShadowInsertionPoint(youngerShadowRoot)");
 
-shadowRoot.innerHTML = "<div><div><div><shadow></shadow></div></div></div>";
-shouldBeTrue("internals.hasShadowInsertionPoint(shadowRoot)");
+    shadowRoot.innerHTML = "<content></content>";
+    shouldBeFalse("internals.hasShadowInsertionPoint(shadowRoot)");
+    shouldBeFalse("internals.hasShadowInsertionPoint(youngerShadowRoot)");
 
-var youngerShadowRoot = host.webkitCreateShadowRoot();
-// Modifying older shadow root or younger shadow root doesn't affect the other.
-shouldBeTrue("internals.hasShadowInsertionPoint(shadowRoot)");
-shouldBeFalse("internals.hasShadowInsertionPoint(youngerShadowRoot)");
+    youngerShadowRoot.innerHTML = "<shadow></shadow>";
+    shouldBeFalse("internals.hasShadowInsertionPoint(shadowRoot)");
+    shouldBeTrue("internals.hasShadowInsertionPoint(youngerShadowRoot)");
+}
 
-shadowRoot.innerHTML = "<content></content>";
-shouldBeFalse("internals.hasShadowInsertionPoint(shadowRoot)");
-shouldBeFalse("internals.hasShadowInsertionPoint(youngerShadowRoot)");
+debug('In the case host is in document');
+host = document.createElement('div');
+wrapper.appendChild(host);
+shadowRoot = host.webkitCreateShadowRoot();
+doTest();
+wrapper.innerHTML = "";
+
+debug('In the case host is not in document');
+host = document.createElement('div');
+shadowRoot = host.webkitCreateShadowRoot();
+doTest();
+wrapper.innerHTML = "";
+
+debug('insertedInto/removedFrom can be called several times.');
+var host = document.createElement('div');
+var shadow = document.createElement('shadow');
+var div1 = document.createElement('div');
+var div2 = document.createElement('div');
+var shadowRoot = host.webkitCreateShadowRoot();
+div1.appendChild(shadow);
+shouldBeFalse('internals.hasShadowInsertionPoint(shadowRoot)');
+shadowRoot.appendChild(div1);
+shouldBeTrue('internals.hasShadowInsertionPoint(shadowRoot)');
+div2.appendChild(host);
+shouldBeTrue('internals.hasShadowInsertionPoint(shadowRoot)');
+div2.removeChild(host);
+shouldBeTrue('internals.hasShadowInsertionPoint(shadowRoot)');
+shadowRoot.removeChild(div1);
+shouldBeFalse('internals.hasShadowInsertionPoint(shadowRoot)');
+div1.removeChild(shadow);
 
-youngerShadowRoot.innerHTML = "<shadow></shadow>";
-shouldBeFalse("internals.hasShadowInsertionPoint(shadowRoot)");
-shouldBeTrue("internals.hasShadowInsertionPoint(youngerShadowRoot)");
 </script>
 <script src="../../js/resources/js-test-post.js"></script>
 </body>
index e671055..431ba14 100644 (file)
@@ -1,3 +1,23 @@
+2012-12-11  Shinya Kawanaka  <shinyak@chromium.org>
+
+        [Shadow DOM] registering InsertionPoints to ShadowRoot should work out of a document.
+        https://bugs.webkit.org/show_bug.cgi?id=104346
+
+        Reviewed by Hajime Morita.
+
+        We need to register InsertionPoints even if ShadowRoot is out of Document, since distribution should work
+        out of Document, too.
+
+        Instead of checking isInDocument(), we have to make sure InsertionPoint and an element which InsertionPoint
+        inserted into have the same treescope.
+
+        Tests: fast/dom/shadow/has-content-elements.html
+               fast/dom/shadow/has-shadow-insertion-point.html
+
+        * html/shadow/InsertionPoint.cpp:
+        (WebCore::InsertionPoint::insertedInto):
+        (WebCore::InsertionPoint::removedFrom):
+
 2012-12-11  Takashi Sakamoto  <tasak@google.com>
 
         Text nodes in shadow roots don't inherit style properly
index ee8443e..99fd012 100644 (file)
@@ -123,40 +123,38 @@ void InsertionPoint::childrenChanged(bool changedByParser, Node* beforeChange, N
 Node::InsertionNotificationRequest InsertionPoint::insertedInto(ContainerNode* insertionPoint)
 {
     HTMLElement::insertedInto(insertionPoint);
-    if (insertionPoint->inDocument()) {
-        if (ShadowRoot* root = containingShadowRoot()) {
-            root->owner()->setValidityUndetermined();
-            root->owner()->invalidateDistribution();
-            if (isActive() && !m_registeredWithShadowRoot) {
-                m_registeredWithShadowRoot = true;
-                root->registerInsertionPoint(this);
-            }
+
+    if (ShadowRoot* root = containingShadowRoot()) {
+        root->owner()->setValidityUndetermined();
+        root->owner()->invalidateDistribution();
+        if (isActive() && !m_registeredWithShadowRoot && insertionPoint->treeScope()->rootNode() == root) {
+            m_registeredWithShadowRoot = true;
+            root->registerInsertionPoint(this);
         }
     }
 
+
     return InsertionDone;
 }
 
 void InsertionPoint::removedFrom(ContainerNode* insertionPoint)
 {
-    if (insertionPoint->inDocument()) {
-        ShadowRoot* root = containingShadowRoot();
-        if (!root)
-            root = insertionPoint->containingShadowRoot();
-
-        // host can be null when removedFrom() is called from ElementShadow destructor.
-        ElementShadow* rootOwner = root ? root->owner() : 0;
-        if (rootOwner)
-            rootOwner->invalidateDistribution();
-
-        // Since this insertion point is no longer visible from the shadow subtree, it need to clean itself up.
-        clearDistribution();
-
-        if (m_registeredWithShadowRoot) {
-            m_registeredWithShadowRoot = false;
-            if (root)
-                root->unregisterInsertionPoint(this);
-        }
+    ShadowRoot* root = containingShadowRoot();
+    if (!root)
+        root = insertionPoint->containingShadowRoot();
+
+    // host can be null when removedFrom() is called from ElementShadow destructor.
+    ElementShadow* rootOwner = root ? root->owner() : 0;
+    if (rootOwner)
+        rootOwner->invalidateDistribution();
+
+    // Since this insertion point is no longer visible from the shadow subtree, it need to clean itself up.
+    clearDistribution();
+
+    if (m_registeredWithShadowRoot && insertionPoint->treeScope()->rootNode() == root) {
+        ASSERT(root);
+        m_registeredWithShadowRoot = false;
+        root->unregisterInsertionPoint(this);
     }
 
     HTMLElement::removedFrom(insertionPoint);