Make HTMLInputElement.list an HTMLDataListElement

Signed-off-by: 2shiori17 <98276492+2shiori17@users.noreply.github.com>
This commit is contained in:
2shiori17 2023-03-02 19:22:28 +09:00
parent a516281d7d
commit 247a4778ee
2 changed files with 4 additions and 7 deletions

View file

@ -744,7 +744,7 @@ impl HTMLInputElement {
} }
// https://html.spec.whatwg.org/multipage/#concept-input-list // https://html.spec.whatwg.org/multipage/#concept-input-list
fn suggestions_source_element(&self) -> Option<DomRoot<HTMLElement>> { fn suggestions_source_element(&self) -> Option<DomRoot<HTMLDataListElement>> {
let list_string = self let list_string = self
.upcast::<Element>() .upcast::<Element>()
.get_string_attribute(&local_name!("list")); .get_string_attribute(&local_name!("list"));
@ -762,10 +762,7 @@ impl HTMLInputElement {
}); });
first_with_id first_with_id
.as_ref() .as_ref()
.and_then(|el| { .and_then(|el| el.downcast::<HTMLDataListElement>())
el.downcast::<HTMLDataListElement>()
.map(|data_el| data_el.upcast::<HTMLElement>())
})
.map(|el| DomRoot::from_ref(&*el)) .map(|el| DomRoot::from_ref(&*el))
} }
@ -1314,7 +1311,7 @@ impl HTMLInputElementMethods for HTMLInputElement {
make_setter!(SetMin, "min"); make_setter!(SetMin, "min");
// https://html.spec.whatwg.org/multipage/#dom-input-list // https://html.spec.whatwg.org/multipage/#dom-input-list
fn GetList(&self) -> Option<DomRoot<HTMLElement>> { fn GetList(&self) -> Option<DomRoot<HTMLDataListElement>> {
self.suggestions_source_element() self.suggestions_source_element()
} }

View file

@ -39,7 +39,7 @@ interface HTMLInputElement : HTMLElement {
attribute boolean indeterminate; attribute boolean indeterminate;
// [CEReactions] // [CEReactions]
// attribute DOMString inputMode; // attribute DOMString inputMode;
readonly attribute HTMLElement? list; readonly attribute HTMLDataListElement? list;
[CEReactions] [CEReactions]
attribute DOMString max; attribute DOMString max;
[CEReactions, SetterThrows] [CEReactions, SetterThrows]