Title: [204528] trunk
- Revision
- 204528
- Author
- [email protected]
- Date
- 2016-08-16 15:26:40 -0700 (Tue, 16 Aug 2016)
Log Message
DOM4: getElementsByClassName should include non StyledElements
https://bugs.webkit.org/show_bug.cgi?id=94718
Reviewed by Ryosuke Niwa.
Source/WebCore:
getElementsByClassName() now includes non StyledElements as per the latest
DOM specification:
- https://dom.spec.whatwg.org/#concept-getelementsbyclassname
The new behavior is consistent with Firefox and Chrome.
Test: fast/dom/getElementsByClassName/non-styled-element.html
* dom/ClassCollection.h:
(WebCore::ClassCollection::elementMatches):
LayoutTests:
* fast/dom/getElementsByClassName/011-expected.txt: Removed.
* fast/dom/getElementsByClassName/011.xml: Removed.
Drop outdated test. It is failing in Firefox and Chrome.
* fast/dom/getElementsByClassName/non-styled-element-expected.txt: Added.
* fast/dom/getElementsByClassName/non-styled-element.html: Added.
Add layout test coverage.
Modified Paths
Added Paths
Removed Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (204527 => 204528)
--- trunk/LayoutTests/ChangeLog 2016-08-16 22:24:23 UTC (rev 204527)
+++ trunk/LayoutTests/ChangeLog 2016-08-16 22:26:40 UTC (rev 204528)
@@ -1,3 +1,18 @@
+2016-08-16 Chris Dumez <[email protected]>
+
+ DOM4: getElementsByClassName should include non StyledElements
+ https://bugs.webkit.org/show_bug.cgi?id=94718
+
+ Reviewed by Ryosuke Niwa.
+
+ * fast/dom/getElementsByClassName/011-expected.txt: Removed.
+ * fast/dom/getElementsByClassName/011.xml: Removed.
+ Drop outdated test. It is failing in Firefox and Chrome.
+
+ * fast/dom/getElementsByClassName/non-styled-element-expected.txt: Added.
+ * fast/dom/getElementsByClassName/non-styled-element.html: Added.
+ Add layout test coverage.
+
2016-08-16 Simon Fraser <[email protected]>
Make it possible to test iOS select elements, and add iPhone and iPad tests for them
Deleted: trunk/LayoutTests/fast/dom/getElementsByClassName/011-expected.txt (204527 => 204528)
--- trunk/LayoutTests/fast/dom/getElementsByClassName/011-expected.txt 2016-08-16 22:24:23 UTC (rev 204527)
+++ trunk/LayoutTests/fast/dom/getElementsByClassName/011-expected.txt 2016-08-16 22:26:40 UTC (rev 204528)
@@ -1,3 +0,0 @@
-PASS
-
-
Deleted: trunk/LayoutTests/fast/dom/getElementsByClassName/011.xml (204527 => 204528)
--- trunk/LayoutTests/fast/dom/getElementsByClassName/011.xml 2016-08-16 22:24:23 UTC (rev 204527)
+++ trunk/LayoutTests/fast/dom/getElementsByClassName/011.xml 2016-08-16 22:26:40 UTC (rev 204528)
@@ -1,19 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:g="http://www.w3.org/2000/svg" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:t="http://tc.labs.opera.com/#test">
- <head>
- <title>document.getElementsByClassName(): "tricky" compound</title>
- <script src=""
- </head>
- <body>
- <p id="r">FAIL (script did not run)</p>
- <x class="a"/>
- <g:x class="a"/>
- <x t:class="a" h:class="a" g:class="a"/>
- <g:x t:class="a" h:class="a" g:class="a"/>
- <t:x class="a" t:class="a" h:class="a" g:class="a"/>
- <script>
- var collection = document.getElementsByClassName("a"),
- test = document.getElementsByTagNameNS("*", "x")
- t(collection, [test[0], test[1]])
- </script>
- </body>
-</html>
Added: trunk/LayoutTests/fast/dom/getElementsByClassName/non-styled-element-expected.txt (0 => 204528)
--- trunk/LayoutTests/fast/dom/getElementsByClassName/non-styled-element-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/getElementsByClassName/non-styled-element-expected.txt 2016-08-16 22:26:40 UTC (rev 204528)
@@ -0,0 +1,11 @@
+Tests that getElementsByClassName() is able to return non-styled elements
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS collection.length is 1
+PASS collection[0] is nonStyledElement
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/getElementsByClassName/non-styled-element.html (0 => 204528)
--- trunk/LayoutTests/fast/dom/getElementsByClassName/non-styled-element.html (rev 0)
+++ trunk/LayoutTests/fast/dom/getElementsByClassName/non-styled-element.html 2016-08-16 22:26:40 UTC (rev 204528)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Tests that getElementsByClassName() is able to return non-styled elements");
+
+var nonStyledElement = document.createElementNS(null, "test");
+nonStyledElement.classList = "myClass";
+document.body.appendChild(nonStyledElement);
+
+var collection = document.getElementsByClassName("myClass");
+shouldBe("collection.length", "1");
+shouldBe("collection[0]", "nonStyledElement");
+</script>
+<script src=""
+<body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (204527 => 204528)
--- trunk/Source/WebCore/ChangeLog 2016-08-16 22:24:23 UTC (rev 204527)
+++ trunk/Source/WebCore/ChangeLog 2016-08-16 22:26:40 UTC (rev 204528)
@@ -1,3 +1,21 @@
+2016-08-16 Chris Dumez <[email protected]>
+
+ DOM4: getElementsByClassName should include non StyledElements
+ https://bugs.webkit.org/show_bug.cgi?id=94718
+
+ Reviewed by Ryosuke Niwa.
+
+ getElementsByClassName() now includes non StyledElements as per the latest
+ DOM specification:
+ - https://dom.spec.whatwg.org/#concept-getelementsbyclassname
+
+ The new behavior is consistent with Firefox and Chrome.
+
+ Test: fast/dom/getElementsByClassName/non-styled-element.html
+
+ * dom/ClassCollection.h:
+ (WebCore::ClassCollection::elementMatches):
+
2016-08-16 Brady Eidson <[email protected]>
Cleanup WK2 platform gamepad handling.
Modified: trunk/Source/WebCore/dom/ClassCollection.h (204527 => 204528)
--- trunk/Source/WebCore/dom/ClassCollection.h 2016-08-16 22:24:23 UTC (rev 204527)
+++ trunk/Source/WebCore/dom/ClassCollection.h 2016-08-16 22:26:40 UTC (rev 204528)
@@ -62,12 +62,8 @@
{
if (!element.hasClass())
return false;
- if (!m_classNames.size())
+ if (m_classNames.isEmpty())
return false;
- // FIXME: DOM4 allows getElementsByClassName to return non StyledElement.
- // https://bugs.webkit.org/show_bug.cgi?id=94718
- if (!element.isStyledElement())
- return false;
return element.classNames().containsAll(m_classNames);
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes