mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 20:17:13 +02:00
LibWeb: Override HTMLFormElement::is_supported_property_name()
By implementing this method ourselves, we no longer go through ::supported_property_names() and skip both the vector allocation and sorting, which we don't need to determine if a property name is present.
This commit is contained in:
committed by
Tim Ledbetter
parent
e63af74dda
commit
6171cb7bbf
Notes:
github-actions[bot]
2026-04-21 13:04:00 +00:00
Author: https://github.com/gmta Commit: https://github.com/LadybirdBrowser/ladybird/commit/6171cb7bbf8 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/9009 Reviewed-by: https://github.com/tcl3 ✅
@@ -1011,6 +1011,19 @@ Optional<JS::Value> HTMLFormElement::item_value(size_t index) const
|
||||
return {};
|
||||
}
|
||||
|
||||
bool HTMLFormElement::is_supported_property_name(FlyString const& name) const
|
||||
{
|
||||
// NB: This is a simplified version of ::supported_property_names() that does not require sorting or allocations.
|
||||
for (auto const& candidate : m_associated_elements) {
|
||||
if (is_form_control(*candidate, *this) || is<HTMLImageElement>(*candidate)) {
|
||||
if (first_is_one_of(name, candidate->id(), candidate->name()))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return m_past_names_map.contains(name);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#the-form-element:supported-property-names
|
||||
Vector<FlyString> HTMLFormElement::supported_property_names() const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user