[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/3.5/kdelibs/khtml/xml
From:       Maks Orlovich <maksim () kde ! org>
Date:       2005-12-23 17:16:29
Message-ID: 1135358189.072255.28320.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 490910 by orlovich:

Get the insertedIntoDocument/removedFromDocument notifications right on out-of-document fragments
BUG:117959


 M  +8 -4      dom_nodeimpl.cpp  


--- branches/KDE/3.5/kdelibs/khtml/xml/dom_nodeimpl.cpp #490909:490910
@@ -1175,6 +1175,7 @@
 
 void NodeBaseImpl::removeChildren()
 {
+    bool inDoc = inDocument();
     NodeImpl *n, *next;
     for( n = _first, _first = 0; n; n = next )
     {
@@ -1184,11 +1185,13 @@
         n->setPreviousSibling(0);
         n->setNextSibling(0);
         n->setParent(0);
+
+        if ( inDoc )
+            for ( NodeImpl* c = n; c; c = c->traverseNextNode( n ) )
+                c->removedFromDocument();
+
         if( !n->refCount() )
             delete n;
-        else
-            for ( NodeImpl* c = n; c; c = c->traverseNextNode( n ) )
-                c->removedFromDocument();
     }
     _last = 0;
 }
@@ -1324,7 +1327,8 @@
         _first = _last = newChild;
     }
 
-    newChild->insertedIntoDocument();
+    if (inDocument())
+        newChild->insertedIntoDocument();
     childrenChanged();
 
     if(newChild->nodeType() == Node::ELEMENT_NODE)
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic