fieldset.elements should return an HTMLCollection instead of an HTMLFormControlsColle...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Oct 2018 00:26:41 +0000 (00:26 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Oct 2018 00:26:41 +0000 (00:26 +0000)
commit474015b7363e738ad4f1c765cfc55b8a26fd8800
treede564ecf253ae09ad7d138c3a28de3e8776bcd99
parent4f1675d14aee496db01c7fadf0e80e0f15097264
fieldset.elements should return an HTMLCollection instead of an HTMLFormControlsCollection
https://bugs.webkit.org/show_bug.cgi?id=190218

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaseline existing WPT test now that it is passing.

* web-platform-tests/html/semantics/forms/the-fieldset-element/HTMLFieldSetElement-expected.txt:

Source/WebCore:

fieldset.elements should return an HTMLCollection instead of an HTMLFormControlsCollection:
- https://github.com/whatwg/html/commit/8beedf0c2ffd38853caddec67490288f47afc8eb

Gecko has always behaved this way. Blink aligned with Gecko and the HTML specification in December 2016:
- https://bugs.chromium.org/p/chromium/issues/detail?id=665291

This simplifies our HTMLFieldSetElement code a lot.

Test: fast/forms/fieldset/fieldset-elements-htmlcollection.html

* html/CollectionType.h:
* html/GenericCachedHTMLCollection.cpp:
(WebCore::GenericCachedHTMLCollection<traversalType>::elementMatches const):
* html/HTMLCollection.cpp:
(WebCore::HTMLCollection::rootTypeFromCollectionType):
(WebCore::invalidationTypeExcludingIdAndNameAttributes):
* html/HTMLFieldSetElement.cpp:
(WebCore::HTMLFieldSetElement::elements):
* html/HTMLFieldSetElement.h:
* html/HTMLFieldSetElement.idl:
* html/HTMLFormControlsCollection.cpp:
(WebCore::HTMLFormControlsCollection::HTMLFormControlsCollection):
(WebCore:: const):
(WebCore::HTMLFormControlsCollection::copyFormControlElementsVector const):
(WebCore::HTMLFormControlsCollection::ownerNode const):
(WebCore::HTMLFormControlsCollection::updateNamedElementCache const):
* html/HTMLFormControlsCollection.h:

LayoutTests:

Update existing tests to reflect behavior change, after checking that our behavior is consistent
with Gecko and Blink on these tests.

* fast/forms/fieldset/fieldset-elements-expected.txt:
* fast/forms/fieldset/fieldset-elements-htmlcollection-expected.txt: Added.
* fast/forms/fieldset/fieldset-elements-htmlcollection.html: Added.
* fast/forms/fieldset/fieldset-elements.html:
* fast/forms/fieldset/fieldset-form-collection-radionode-list-expected.txt: Removed.
* fast/forms/fieldset/fieldset-form-collection-radionode-list.html: Removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236778 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/forms/fieldset/fieldset-elements-expected.txt
LayoutTests/fast/forms/fieldset/fieldset-elements-htmlcollection-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/fieldset/fieldset-elements-htmlcollection.html [new file with mode: 0644]
LayoutTests/fast/forms/fieldset/fieldset-elements.html
LayoutTests/fast/forms/fieldset/fieldset-form-collection-radionode-list-expected.txt [deleted file]
LayoutTests/fast/forms/fieldset/fieldset-form-collection-radionode-list.html [deleted file]
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-fieldset-element/HTMLFieldSetElement-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/html/CollectionType.h
Source/WebCore/html/GenericCachedHTMLCollection.cpp
Source/WebCore/html/HTMLCollection.cpp
Source/WebCore/html/HTMLFieldSetElement.cpp
Source/WebCore/html/HTMLFieldSetElement.h
Source/WebCore/html/HTMLFieldSetElement.idl
Source/WebCore/html/HTMLFormControlsCollection.cpp
Source/WebCore/html/HTMLFormControlsCollection.h