Reviewed by Darin.
authorap@webkit.org <ap@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 6 Jan 2008 19:35:43 +0000 (19:35 +0000)
committerap@webkit.org <ap@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 6 Jan 2008 19:35:43 +0000 (19:35 +0000)
        http://bugs.webkit.org/show_bug.cgi?id=16731
        Incorrect node type for whitespace when setting innerHTML in an XHTML document

        Test: fast/dom/xhtml-fragment-whitespace.xhtml

        * dom/XMLTokenizer.cpp: (WebCore::parseXMLDocumentFragment):
        Use balancedCharactersHandler for ignorable whitespace.

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

LayoutTests/ChangeLog
LayoutTests/fast/dom/xhtml-fragment-whitespace-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/xhtml-fragment-whitespace.xhtml [new file with mode: 0644]
WebCore/ChangeLog
WebCore/dom/XMLTokenizer.cpp

index 1a338435f1a74d8a4a79e23ed7a1dadee14901d7..a1661bda23d25d5c2aa35a832e0fb44aabf343ad 100644 (file)
@@ -1,3 +1,13 @@
+2008-01-06  Alexey Proskuryakov  <ap@webkit.org>
+
+        Reviewed by Darin.
+
+        http://bugs.webkit.org/show_bug.cgi?id=16731
+        Incorrect node type for whitespace when setting innerHTML in an XHTML document
+
+        * fast/dom/xhtml-fragment-whitespace-expected.txt: Added.
+        * fast/dom/xhtml-fragment-whitespace.xhtml: Added.
+
 2008-01-06  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Darin.
 2008-01-06  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Darin.
diff --git a/LayoutTests/fast/dom/xhtml-fragment-whitespace-expected.txt b/LayoutTests/fast/dom/xhtml-fragment-whitespace-expected.txt
new file mode 100644 (file)
index 0000000..9ecaf66
--- /dev/null
@@ -0,0 +1,3 @@
+Test for bug 16731: Incorrect node type for whitespace when setting innerHTML in an XHTML document.
+
+SUCCESS
diff --git a/LayoutTests/fast/dom/xhtml-fragment-whitespace.xhtml b/LayoutTests/fast/dom/xhtml-fragment-whitespace.xhtml
new file mode 100644 (file)
index 0000000..6044901
--- /dev/null
@@ -0,0 +1,21 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<script>
+function test() {
+  if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+  var target = document.getElementById('target');
+
+  target.innerHTML += "\t&lt;p>&lt;/p>";
+  if (target.firstChild.nodeName == "#text")
+    target.innerHTML = "SUCCESS";
+  else
+    target.innerHTML = "FAIL. Incorrect node type for whitespace: " + target.firstChild.nodeName + ".";
+}
+</script>
+<body onload="test();">
+    <p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=16731">bug 16731</a>:
+    Incorrect node type for whitespace when setting innerHTML in an XHTML document.</p>
+    <div id="target"></div>
+</body>
+</html>
index 348eeb0885b6f151b7b57e7d7929cd6efc65be03..3a7199b42f7630b29be3901e2ef63efb4ba297da 100644 (file)
@@ -1,3 +1,15 @@
+2008-01-06  Alexey Proskuryakov  <ap@webkit.org>
+
+        Reviewed by Darin.
+
+        http://bugs.webkit.org/show_bug.cgi?id=16731
+        Incorrect node type for whitespace when setting innerHTML in an XHTML document
+
+        Test: fast/dom/xhtml-fragment-whitespace.xhtml
+
+        * dom/XMLTokenizer.cpp: (WebCore::parseXMLDocumentFragment):
+        Use balancedCharactersHandler for ignorable whitespace.
+
 2008-01-06  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Darin.
 2008-01-06  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Darin.
index 0f363897d7d3bf9d639bfef7e8389ea6adcc77a9..75d8dd4156805afdfe7a7d33adea7a380e1671af 100644 (file)
@@ -1577,7 +1577,7 @@ bool parseXMLDocumentFragment(const String& string, DocumentFragment* fragment,
     sax.startElementNs = balancedStartElementNsHandler;
     sax.endElementNs = balancedEndElementNsHandler;
     sax.cdataBlock = balancedCdataBlockHandler;
     sax.startElementNs = balancedStartElementNsHandler;
     sax.endElementNs = balancedEndElementNsHandler;
     sax.cdataBlock = balancedCdataBlockHandler;
-    sax.ignorableWhitespace = balancedCdataBlockHandler;
+    sax.ignorableWhitespace = balancedCharactersHandler;
     sax.comment = balancedCommentHandler;
     sax.warning = balancedWarningHandler;
     sax.initialized = XML_SAX2_MAGIC;
     sax.comment = balancedCommentHandler;
     sax.warning = balancedWarningHandler;
     sax.initialized = XML_SAX2_MAGIC;