Skip to content

Commit cb9118e

Browse files
shannonboothawesomekling
authored andcommitted
LibWeb: Use cached Element::id in HTMLFormControlsCollection
1 parent 44089ce commit cb9118e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Userland/Libraries/LibWeb/DOM/HTMLFormControlsCollection.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Variant<Empty, Element*, JS::Handle<RadioNodeList>> HTMLFormControlsCollection::
4848

4949
auto collection = collect_matching_elements();
5050
for (auto const& element : collection) {
51-
if (element->deprecated_attribute(HTML::AttributeNames::id) != deprecated_name && element->name() != deprecated_name)
51+
if (element->id() != name && element->name() != deprecated_name)
5252
continue;
5353

5454
if (matching_element) {
@@ -68,12 +68,12 @@ Variant<Empty, Element*, JS::Handle<RadioNodeList>> HTMLFormControlsCollection::
6868
// 4. Otherwise, create a new RadioNodeList object representing a live view of the HTMLFormControlsCollection object, further filtered so that the only nodes in the
6969
// RadioNodeList object are those that have either an id attribute or a name attribute equal to name. The nodes in the RadioNodeList object must be sorted in tree
7070
// order. Return that RadioNodeList object.
71-
return JS::make_handle(RadioNodeList::create(realm(), root(), LiveNodeList::Scope::Descendants, [deprecated_name](Node const& node) {
71+
return JS::make_handle(RadioNodeList::create(realm(), root(), LiveNodeList::Scope::Descendants, [name, deprecated_name](Node const& node) {
7272
if (!is<Element>(node))
7373
return false;
7474

7575
auto const& element = verify_cast<Element>(node);
76-
return element.deprecated_attribute(HTML::AttributeNames::id) == deprecated_name || element.name() == deprecated_name;
76+
return element.id() == name || element.name() == deprecated_name;
7777
}));
7878
}
7979

0 commit comments

Comments
 (0)