RESOLVED CONFIGURATION CHANGED 190626
[Datalist] imported/w3c/web-platform-tests/html/semantics/forms/the-datalist-element/datalistoptions.html fails after enabling the datalist element
https://bugs.webkit.org/show_bug.cgi?id=190626
Summary [Datalist] imported/w3c/web-platform-tests/html/semantics/forms/the-datalist-...
Wenson Hsieh
Reported 2018-10-16 10:10:49 PDT
See: GenericCachedHTMLCollection.cpp: GenericCachedHTMLCollection<traversalType>::elementMatches handles DataListOptions by filtering out disabled and empty option elements, which means HTMLDataListElement.options() won't include disabled or empty options. However, this WPT checks that HTMLDataListElement.options() does include empty and disabled options. The official spec has this to say: <https://www.w3.org/TR/html52/sec-forms.html#the-datalist-element> > Each option element that is a descendant of the datalist element, that is not disabled, and whose value is a string that isn’t the empty string, represents a suggestion. Each suggestion has a value and a label. > > datalist . options > > Returns an HTMLCollection of the option elements of the datalist element. > The options IDL attribute must return an HTMLCollection rooted at the datalist node, whose filter matches option elements. So the spec makes it clear what a suggestion is w.r.t. the datalist element, but it never specifies that there's a 1-1 mapping between a datalist element's options and its suggestions...
Attachments
Wenson Hsieh
Comment 1 2018-10-16 10:18:28 PDT
FWIW, removing the `!option.isDisabledFormControl() && !option.value().isEmpty()` check fixes this WPT, but causes another test, fast/forms/datalist/datalist.html, to fail. fast/forms/datalist/datalist.html verifies that empty and disabled option elements are *not* included in datalist's list of options, so clearly, one of these tests needs to be updated!
Chris Dumez
Comment 2 2018-10-16 10:24:18 PDT
My interpretation of the specification is that we should returns all options (even if disabled): https://html.spec.whatwg.org/#dom-datalist-options """ The options IDL attribute must return an HTMLCollection rooted at the datalist node, whose filter matches option elements. """ That said, it would be worth testing other browsers and match what they do.
Chris Dumez
Comment 3 2018-10-16 10:26:48 PDT
(In reply to Chris Dumez from comment #2) > My interpretation of the specification is that we should returns all options > (even if disabled): > https://html.spec.whatwg.org/#dom-datalist-options > > """ > The options IDL attribute must return an HTMLCollection rooted at the > datalist node, whose filter matches option elements. > """ > > That said, it would be worth testing other browsers and match what they do. Chrome passes http://w3c-test.org/html/semantics/forms/the-datalist-element/datalistoptions.html but Firefox fails. Anyway, it seems Chrome and the spec agree so I would suggest matching Chrome / spec behavior.
Wenson Hsieh
Comment 4 2018-10-16 10:27:59 PDT
(In reply to Chris Dumez from comment #3) > (In reply to Chris Dumez from comment #2) > > My interpretation of the specification is that we should returns all options > > (even if disabled): > > https://html.spec.whatwg.org/#dom-datalist-options > > > > """ > > The options IDL attribute must return an HTMLCollection rooted at the > > datalist node, whose filter matches option elements. > > """ Yep, I agree with this interpretation. > > > > That said, it would be worth testing other browsers and match what they do. > > Chrome passes > http://w3c-test.org/html/semantics/forms/the-datalist-element/ > datalistoptions.html but Firefox fails. > > Anyway, it seems Chrome and the spec agree so I would suggest matching > Chrome / spec behavior. Sounds good — thanks, Chris!
Ahmad Saleem
Comment 5 2023-02-01 14:13:15 PST
Note You need to log in before you can comment on or make changes to this bug.