Title: [243734] trunk
Revision
243734
Author
[email protected]
Date
2019-04-01 20:14:50 -0700 (Mon, 01 Apr 2019)

Log Message

Attr nodes are not cloned properly
https://bugs.webkit.org/show_bug.cgi?id=196466

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Rebaseline WPT test now that one more check is passing.

* web-platform-tests/dom/nodes/Document-importNode-expected.txt:

Source/WebCore:

Attr nodes are not cloned properly according to:
- https://dom.spec.whatwg.org/#concept-node-clone

A cloned Attr node should retain its prefix and namespace.

Both Gecko and Blink agree with the DOM specification here.

No new tests, rebaselined existing test.

* dom/Document.cpp:
(WebCore::Document::importNode):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (243733 => 243734)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2019-04-02 03:12:39 UTC (rev 243733)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2019-04-02 03:14:50 UTC (rev 243734)
@@ -1,5 +1,16 @@
 2019-04-01  Chris Dumez  <[email protected]>
 
+        Attr nodes are not cloned properly
+        https://bugs.webkit.org/show_bug.cgi?id=196466
+
+        Reviewed by Ryosuke Niwa.
+
+        Rebaseline WPT test now that one more check is passing.
+
+        * web-platform-tests/dom/nodes/Document-importNode-expected.txt:
+
+2019-04-01  Chris Dumez  <[email protected]>
+
         Support "noreferrer" for window.open()
         https://bugs.webkit.org/show_bug.cgi?id=194533
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Document-importNode-expected.txt (243733 => 243734)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Document-importNode-expected.txt	2019-04-02 03:12:39 UTC (rev 243733)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Document-importNode-expected.txt	2019-04-02 03:14:50 UTC (rev 243734)
@@ -3,5 +3,5 @@
 PASS Undefined 'deep' argument. 
 PASS True 'deep' argument. 
 PASS False 'deep' argument. 
-FAIL Import an Attr node with namespace/prefix correctly. assert_equals: expected (string) "p" but got (object) null
+PASS Import an Attr node with namespace/prefix correctly. 
 

Modified: trunk/Source/WebCore/ChangeLog (243733 => 243734)


--- trunk/Source/WebCore/ChangeLog	2019-04-02 03:12:39 UTC (rev 243733)
+++ trunk/Source/WebCore/ChangeLog	2019-04-02 03:14:50 UTC (rev 243734)
@@ -1,3 +1,22 @@
+2019-04-01  Chris Dumez  <[email protected]>
+
+        Attr nodes are not cloned properly
+        https://bugs.webkit.org/show_bug.cgi?id=196466
+
+        Reviewed by Ryosuke Niwa.
+
+        Attr nodes are not cloned properly according to:
+        - https://dom.spec.whatwg.org/#concept-node-clone
+
+        A cloned Attr node should retain its prefix and namespace.
+
+        Both Gecko and Blink agree with the DOM specification here.
+
+        No new tests, rebaselined existing test.
+
+        * dom/Document.cpp:
+        (WebCore::Document::importNode):
+
 2019-04-01  Said Abou-Hallawa  <[email protected]>
 
         Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList

Modified: trunk/Source/WebCore/dom/Document.cpp (243733 => 243734)


--- trunk/Source/WebCore/dom/Document.cpp	2019-04-02 03:12:39 UTC (rev 243733)
+++ trunk/Source/WebCore/dom/Document.cpp	2019-04-02 03:14:50 UTC (rev 243734)
@@ -988,10 +988,10 @@
     case COMMENT_NODE:
         return nodeToImport.cloneNodeInternal(document(), deep ? CloningOperation::Everything : CloningOperation::OnlySelf);
 
-    case ATTRIBUTE_NODE:
-        // FIXME: This will "Attr::normalize" child nodes of Attr.
-        return Ref<Node> { Attr::create(*this, QualifiedName(nullAtom(), downcast<Attr>(nodeToImport).name(), nullAtom()), downcast<Attr>(nodeToImport).value()) };
-
+    case ATTRIBUTE_NODE: {
+        auto& attribute = downcast<Attr>(nodeToImport);
+        return Ref<Node> { Attr::create(*this, attribute.qualifiedName(), attribute.value()) };
+    }
     case DOCUMENT_NODE: // Can't import a document into another document.
     case DOCUMENT_TYPE_NODE: // FIXME: Support cloning a DocumentType node per DOM4.
         break;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to