Reviewed and landed by Darin.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 14 Aug 2005 08:18:51 +0000 (08:18 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 14 Aug 2005 08:18:51 +0000 (08:18 +0000)
        Test cases added:
        * layout-tests/dom/html/level2/core/hc_nodedocumentfragmentnormalize2-expected.txt:
This passes now.

        * khtml/xml/dom_nodeimpl.cpp:
        (DOM::NodeImpl::normalize):
If there's a single empty text child, remove it.

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

LayoutTests/dom/html/level2/core/hc_nodedocumentfragmentnormalize2-expected.txt
WebCore/ChangeLog-2005-08-23
WebCore/khtml/xml/dom_nodeimpl.cpp

index 9a9daaaafc5e24bba76f9de75d185dbfae78d67d..4a37f8b232b8d88ecbdcdbd8fedeb390ba333c67 100644 (file)
@@ -1,3 +1,2 @@
-Test:  http://www.w3.org/2001/DOM-Test-Suite/level2/core/hc_nodedocumentfragmentnormalize2     
-Status:        failure
-Detail:        noChild: assertNull failed, actual [object Text]
+Test:  http://www.w3.org/2001/DOM-Test-Suite/level2/core/hc_nodedocumentfragmentnormalize2
+Status:        Success
index 687277fa353112f6ddf39f2ff09ce72c8bac23fb..2e976f19656d5d0f40e48991f1d0a745e29e855a 100644 (file)
@@ -1,3 +1,15 @@
+2005-08-14  Anders Carlsson  <andersca@mac.com>
+
+        Reviewed and landed by Darin.
+
+        Test cases added: 
+        * layout-tests/dom/html/level2/core/hc_nodedocumentfragmentnormalize2-expected.txt:
+       This passes now.
+       
+        * khtml/xml/dom_nodeimpl.cpp:
+        (DOM::NodeImpl::normalize):
+       If there's a single empty text child, remove it.
+       
 2005-08-14  Anders Carlsson  <andersca@mac.com>
 
         Reviewed and landed by Darin.
index 2df1fef8955f92716693101a3a354a6752681a6d..64b1e49b7977cefb93f0acca7a27b0dda7c52807 100644 (file)
@@ -260,6 +260,14 @@ void NodeImpl::normalize ()
             child = nextChild;
         }
     }
+    
+    // Check if we have a single empty text node left and remove it if so
+    child = firstChild();
+    if (child && !child->nextSibling() && child->isTextNode()) {
+        TextImpl *text = static_cast<TextImpl*>(child);
+        if (text->data().isEmpty())
+            removeChild(child, exceptioncode);
+    }
 }
 
 const AtomicString& NodeImpl::prefix() const