Title: [143663] trunk
Revision
143663
Author
a...@chromium.org
Date
2013-02-21 16:27:15 -0800 (Thu, 21 Feb 2013)

Log Message

Nodes should not have attributes property
https://bugs.webkit.org/show_bug.cgi?id=110510

Reviewed by Adam Barth.

Source/WebCore:

According to http://dom.spec.whatwg.org/ attributes and hasAttributes
should be defined on Element and not on Node.

Test: fast/dom/Text/text-should-not-have-attributes.html

* dom/Element.idl:
* dom/Node.idl:

LayoutTests:

* fast/dom/Node/initial-values-expected.txt:
* fast/dom/Node/script-tests/initial-values.js:
* fast/dom/Text/text-should-not-have-attributes-expected.txt: Added.
* fast/dom/Text/text-should-not-have-attributes.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (143662 => 143663)


--- trunk/LayoutTests/ChangeLog	2013-02-22 00:26:16 UTC (rev 143662)
+++ trunk/LayoutTests/ChangeLog	2013-02-22 00:27:15 UTC (rev 143663)
@@ -1,3 +1,15 @@
+2013-02-21  Erik Arvidsson  <a...@chromium.org>
+
+        Nodes should not have attributes property
+        https://bugs.webkit.org/show_bug.cgi?id=110510
+
+        Reviewed by Adam Barth.
+
+        * fast/dom/Node/initial-values-expected.txt:
+        * fast/dom/Node/script-tests/initial-values.js:
+        * fast/dom/Text/text-should-not-have-attributes-expected.txt: Added.
+        * fast/dom/Text/text-should-not-have-attributes.html: Added.
+
 2013-02-21  Alok Priyadarshi  <al...@chromium.org>
 
         Suppressed failing tests after r143626.

Modified: trunk/LayoutTests/fast/dom/Node/initial-values-expected.txt (143662 => 143663)


--- trunk/LayoutTests/fast/dom/Node/initial-values-expected.txt	2013-02-22 00:26:16 UTC (rev 143662)
+++ trunk/LayoutTests/fast/dom/Node/initial-values-expected.txt	2013-02-22 00:27:15 UTC (rev 143663)
@@ -11,7 +11,6 @@
 PASS attr.prefix is null
 PASS attr.nodeValue is ''
 PASS attr.value is ''
-PASS attr.attributes is null
 Attribute creation using createElementNS on an HTML doc:
 PASS attr.nodeName is 'example:foo'
 PASS attr.name is 'example:foo'
@@ -20,7 +19,6 @@
 PASS attr.prefix is 'example'
 PASS attr.nodeValue is ''
 PASS attr.value is ''
-PASS attr.attributes is null
 Attribute creation using createElement on an XHTML doc:
 PASS attr.nodeName is 'foo'
 PASS attr.name is 'foo'
@@ -29,7 +27,6 @@
 PASS attr.prefix is null
 PASS attr.nodeValue is ''
 PASS attr.value is ''
-PASS attr.attributes is null
 Attribute creation using createElementNS on an XHTML doc:
 PASS attr.nodeName is 'example:foo'
 PASS attr.name is 'example:foo'
@@ -38,14 +35,12 @@
 PASS attr.prefix is 'example'
 PASS attr.nodeValue is ''
 PASS attr.value is ''
-PASS attr.attributes is null
 PASS comment.nodeName is '#comment'
 PASS comment.localName is null
 PASS comment.namespaceURI is null
 PASS comment.prefix is null
 PASS comment.nodeValue is 'foo'
 PASS comment.data is 'foo'
-PASS comment.attributes is null
 PASS document.createCDATASection('foo') threw exception Error: NotSupportedError: DOM Exception 9.
 PASS cdata.nodeName is '#cdata-section'
 PASS cdata.localName is null
@@ -53,26 +48,22 @@
 PASS cdata.prefix is null
 PASS cdata.nodeValue is 'foo'
 PASS cdata.data is 'foo'
-PASS cdata.attributes is null
 PASS fragment.nodeName is '#document-fragment'
 PASS fragment.localName is null
 PASS fragment.namespaceURI is null
 PASS fragment.prefix is null
 PASS fragment.nodeValue is null
-PASS fragment.attributes is null
 PASS doc.nodeName is '#document'
 PASS doc.localName is null
 FAIL doc.namespaceURI should be http://www.w3.org/1999/xhtml (of type string). Was null (of type object).
 PASS doc.prefix is null
 PASS doc.nodeValue is null
-PASS doc.attributes is null
 PASS doctype.nodeName is 'svg'
 PASS doctype.name is 'svg'
 PASS doctype.localName is null
 PASS doctype.namespaceURI is null
 PASS doctype.prefix is null
 PASS doctype.nodeValue is null
-PASS doctype.attributes is null
 Element creation using createElement on an HTML doc:
 PASS element.nodeName is 'PRE'
 FAIL element.localName should be null (of type object). Was pre (of type string).
@@ -128,14 +119,12 @@
 PASS entityReference.namespaceURI is null
 PASS entityReference.prefix is null
 PASS entityReference.nodeValue is null
-PASS entityReference.attributes is null
 PASS document.createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="" threw exception Error: NotSupportedError: DOM Exception 9.
 PASS processingInstruction.nodeName is 'xml-stylesheet'
 PASS processingInstruction.localName is null
 PASS processingInstruction.namespaceURI is null
 PASS processingInstruction.prefix is null
 PASS processingInstruction.nodeValue is 'type="text/xsl" href=""
-PASS processingInstruction.attributes is null
 PASS processingInstruction.target is 'xml-stylesheet'
 PASS processingInstruction.data is 'type="text/xsl" href=""
 PASS text.nodeName is '#text'
@@ -144,7 +133,6 @@
 PASS text.prefix is null
 PASS text.nodeValue is 'foo'
 PASS text.data is 'foo'
-PASS text.attributes is null
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/dom/Node/script-tests/initial-values.js (143662 => 143663)


--- trunk/LayoutTests/fast/dom/Node/script-tests/initial-values.js	2013-02-22 00:26:16 UTC (rev 143662)
+++ trunk/LayoutTests/fast/dom/Node/script-tests/initial-values.js	2013-02-22 00:27:15 UTC (rev 143663)
@@ -13,7 +13,6 @@
 shouldBe("attr.prefix", "null");
 shouldBe("attr.nodeValue", "''");
 shouldBe("attr.value", "''");
-shouldBe("attr.attributes", "null");
 
 debug("Attribute creation using createElementNS on an HTML doc:")
 attr = document.createAttributeNS("http://www.example.com", "example:foo");
@@ -24,7 +23,6 @@
 shouldBe("attr.prefix", "'example'");
 shouldBe("attr.nodeValue", "''");
 shouldBe("attr.value", "''");
-shouldBe("attr.attributes", "null");
 
 debug("Attribute creation using createElement on an XHTML doc:")
 attr = xmlDoc.createAttribute("foo");
@@ -37,7 +35,6 @@
 shouldBe("attr.prefix", "null");
 shouldBe("attr.nodeValue", "''");
 shouldBe("attr.value", "''");
-shouldBe("attr.attributes", "null");
 
 debug("Attribute creation using createElementNS on an XHTML doc:")
 attr = xmlDoc.createAttributeNS("http://www.example.com", "example:foo");
@@ -48,7 +45,6 @@
 shouldBe("attr.prefix", "'example'");
 shouldBe("attr.nodeValue", "''");
 shouldBe("attr.value", "''");
-shouldBe("attr.attributes", "null");
 
 var comment = document.createComment("foo");
 shouldBe("comment.nodeName", "'#comment'");
@@ -57,7 +53,6 @@
 shouldBe("comment.prefix", "null");
 shouldBe("comment.nodeValue", "'foo'");
 shouldBe("comment.data", "'foo'");
-shouldBe("comment.attributes", "null");
 
 shouldThrow("document.createCDATASection('foo')");
 var cdata = xmlDoc.createCDATASection("foo");
@@ -67,7 +62,6 @@
 shouldBe("cdata.prefix", "null");
 shouldBe("cdata.nodeValue", "'foo'");
 shouldBe("cdata.data", "'foo'");
-shouldBe("cdata.attributes", "null");
 
 var fragment = document.createDocumentFragment();
 shouldBe("fragment.nodeName", "'#document-fragment'");
@@ -75,7 +69,6 @@
 shouldBe("fragment.namespaceURI", "null");
 shouldBe("fragment.prefix", "null");
 shouldBe("fragment.nodeValue", "null");
-shouldBe("fragment.attributes", "null");
 
 var doc = document.implementation.createDocument("http://www.w3.org/1999/xhtml", "html", null);
 shouldBe("doc.nodeName", "'#document'");
@@ -85,7 +78,6 @@
 shouldBe("doc.namespaceURI", "'http://www.w3.org/1999/xhtml'");
 shouldBe("doc.prefix", "null");
 shouldBe("doc.nodeValue", "null");
-shouldBe("doc.attributes", "null");
 
 var doctype = document.implementation.createDocumentType("svg", "-//W3C//DTD SVG 1.1//EN", "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd");
 shouldBe("doctype.nodeName", "'svg'");
@@ -94,7 +86,6 @@
 shouldBe("doctype.namespaceURI", "null");
 shouldBe("doctype.prefix", "null");
 shouldBe("doctype.nodeValue", "null");
-shouldBe("doctype.attributes", "null");
 
 debug("Element creation using createElement on an HTML doc:")
 var element = document.createElement("pre");
@@ -174,7 +165,6 @@
 shouldBe("entityReference.namespaceURI", "null");
 shouldBe("entityReference.prefix", "null");
 shouldBe("entityReference.nodeValue", "null");
-shouldBe("entityReference.attributes", "null");
 
 // Not possible to create Notation nodes via the DOM, WebKit doesn't create them from parsing
 
@@ -189,7 +179,6 @@
 // L3: same as ProcessingInstruction.data
 // We're following Level 3
 shouldBe("processingInstruction.nodeValue", "'type=\"text/xsl\" href=""
-shouldBe("processingInstruction.attributes", "null");
 shouldBe("processingInstruction.target", "'xml-stylesheet'");
 shouldBe("processingInstruction.data", "'type=\"text/xsl\" href=""
 
@@ -200,4 +189,3 @@
 shouldBe("text.prefix", "null");
 shouldBe("text.nodeValue", "'foo'");
 shouldBe("text.data", "'foo'");
-shouldBe("text.attributes", "null");

Added: trunk/LayoutTests/fast/dom/Text/text-should-not-have-attributes-expected.txt (0 => 143663)


--- trunk/LayoutTests/fast/dom/Text/text-should-not-have-attributes-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Text/text-should-not-have-attributes-expected.txt	2013-02-22 00:27:15 UTC (rev 143663)
@@ -0,0 +1,12 @@
+This tests that Text nodes do no have attributes nor hasAttributes.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Text.prototype.hasOwnProperty("hasAttributes") is false
+PASS "hasAttributes" in text is false
+PASS "attributes" in text is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/dom/Text/text-should-not-have-attributes.html (0 => 143663)


--- trunk/LayoutTests/fast/dom/Text/text-should-not-have-attributes.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Text/text-should-not-have-attributes.html	2013-02-22 00:27:15 UTC (rev 143663)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<script src=""
+<div id="test"></div>
+<script>
+
+description('This tests that Text nodes do no have attributes nor hasAttributes.');
+
+shouldBeFalse('Text.prototype.hasOwnProperty("hasAttributes")');
+
+var text = document.createTextNode('text');
+shouldBeFalse('"hasAttributes" in text');
+shouldBeFalse('"attributes" in text');
+
+</script>
+<script src=""

Modified: trunk/Source/WebCore/ChangeLog (143662 => 143663)


--- trunk/Source/WebCore/ChangeLog	2013-02-22 00:26:16 UTC (rev 143662)
+++ trunk/Source/WebCore/ChangeLog	2013-02-22 00:27:15 UTC (rev 143663)
@@ -1,3 +1,18 @@
+2013-02-21  Erik Arvidsson  <a...@chromium.org>
+
+        Nodes should not have attributes property
+        https://bugs.webkit.org/show_bug.cgi?id=110510
+
+        Reviewed by Adam Barth.
+
+        According to http://dom.spec.whatwg.org/ attributes and hasAttributes
+        should be defined on Element and not on Node.
+
+        Test: fast/dom/Text/text-should-not-have-attributes.html
+
+        * dom/Element.idl:
+        * dom/Node.idl:
+
 2013-02-21  Tony Gentilcore  <to...@chromium.org>
 
         Make BackgroundHTMLParser rewind the preload scanner instead of clear it

Modified: trunk/Source/WebCore/dom/Element.idl (143662 => 143663)


--- trunk/Source/WebCore/dom/Element.idl	2013-02-22 00:26:16 UTC (rev 143662)
+++ trunk/Source/WebCore/dom/Element.idl	2013-02-22 00:27:15 UTC (rev 143663)
@@ -41,6 +41,12 @@
         raises(DOMException);
     NodeList getElementsByTagName(in [Optional=DefaultIsUndefined] DOMString name);
 
+#if !defined(LANGUAGE_OBJECTIVE_C)
+    // For ObjC this is defined on Node for legacy support.
+    readonly attribute NamedNodeMap     attributes;
+    boolean            hasAttributes();
+#endif
+
     // DOM Level 2 Core
 
     [ObjCLegacyUnnamedParameters] DOMString getAttributeNS(in [TreatNullAs=NullString,Optional=DefaultIsUndefined] DOMString namespaceURI,

Modified: trunk/Source/WebCore/dom/Node.idl (143662 => 143663)


--- trunk/Source/WebCore/dom/Node.idl	2013-02-22 00:26:16 UTC (rev 143662)
+++ trunk/Source/WebCore/dom/Node.idl	2013-02-22 00:27:15 UTC (rev 143663)
@@ -62,7 +62,6 @@
     readonly attribute Node             lastChild;
     readonly attribute Node             previousSibling;
     readonly attribute Node             nextSibling;
-    readonly attribute NamedNodeMap     attributes;
     readonly attribute Document         ownerDocument;
 
     [ObjCLegacyUnnamedParameters, Custom] Node insertBefore(in [CustomReturn] Node newChild,
@@ -90,8 +89,12 @@
                  setter raises(DOMException);
     readonly attribute [TreatReturnedNullStringAs=Null] DOMString        localName;
 
+#if defined(LANGUAGE_OBJECTIVE_C)
+    readonly attribute NamedNodeMap     attributes;
     boolean            hasAttributes();
+#endif
 
+
     // Introduced in DOM Level 3:
 
     readonly attribute [TreatReturnedNullStringAs=Null] DOMString       baseURI;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to