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 9a9daaa..4a37f8b 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 687277f..2e976f1 100644 (file)
@@ -2,6 +2,18 @@
 
         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.
+
         Test cases added:
         * layout-tests/dom/html/level2/html/HTMLSelectElement20-expected.txt:
        This passes now.
index 2df1fef..64b1e49 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