@@ -129,7 +129,7 @@ static inline bool matches_attribute(CSS::Selector::SimpleSelector::Attribute co
129
129
{
130
130
// FIXME: Check the attribute's namespace, once we support that in DOM::Element!
131
131
132
- auto attribute_name = attribute.qualified_name .name .name . to_deprecated_fly_string () ;
132
+ auto const & attribute_name = attribute.qualified_name .name .name ;
133
133
134
134
if (attribute.match_type == CSS::Selector::SimpleSelector::Attribute::MatchType::HasAttribute) {
135
135
// Early way out in case of an attribute existence selector.
@@ -144,14 +144,14 @@ static inline bool matches_attribute(CSS::Selector::SimpleSelector::Attribute co
144
144
switch (attribute.match_type ) {
145
145
case CSS::Selector::SimpleSelector::Attribute::MatchType::ExactValueMatch:
146
146
return case_insensitive_match
147
- ? Infra::is_ascii_case_insensitive_match (element.deprecated_attribute (attribute_name), attribute.value )
148
- : element.deprecated_attribute (attribute_name) == attribute.value . to_deprecated_string () ;
147
+ ? Infra::is_ascii_case_insensitive_match (element.attribute (attribute_name). value_or ({} ), attribute.value )
148
+ : element.attribute (attribute_name) == attribute.value ;
149
149
case CSS::Selector::SimpleSelector::Attribute::MatchType::ContainsWord: {
150
150
if (attribute.value .is_empty ()) {
151
151
// This selector is always false is match value is empty.
152
152
return false ;
153
153
}
154
- auto const view = element.deprecated_attribute (attribute_name).split_view (' ' );
154
+ auto const view = element.attribute (attribute_name). value_or ({}). bytes_as_string_view ( ).split_view (' ' );
155
155
auto const size = view.size ();
156
156
for (size_t i = 0 ; i < size; ++i) {
157
157
auto const value = view.at (i);
@@ -165,9 +165,9 @@ static inline bool matches_attribute(CSS::Selector::SimpleSelector::Attribute co
165
165
}
166
166
case CSS::Selector::SimpleSelector::Attribute::MatchType::ContainsString:
167
167
return !attribute.value .is_empty ()
168
- && element.deprecated_attribute (attribute_name).contains (attribute.value , case_sensitivity);
168
+ && element.attribute (attribute_name). value_or ({} ).contains (attribute.value , case_sensitivity);
169
169
case CSS::Selector::SimpleSelector::Attribute::MatchType::StartsWithSegment: {
170
- auto const element_attr_value = element.deprecated_attribute (attribute_name);
170
+ auto const element_attr_value = element.attribute (attribute_name). value_or ({} );
171
171
if (element_attr_value.is_empty ()) {
172
172
// If the attribute value on element is empty, the selector is true
173
173
// if the match value is also empty and false otherwise.
@@ -176,17 +176,17 @@ static inline bool matches_attribute(CSS::Selector::SimpleSelector::Attribute co
176
176
if (attribute.value .is_empty ()) {
177
177
return false ;
178
178
}
179
- auto segments = element_attr_value.split_view (' -' );
179
+ auto segments = element_attr_value.bytes_as_string_view (). split_view (' -' );
180
180
return case_insensitive_match
181
181
? Infra::is_ascii_case_insensitive_match (segments.first (), attribute.value )
182
182
: segments.first () == attribute.value ;
183
183
}
184
184
case CSS::Selector::SimpleSelector::Attribute::MatchType::StartsWithString:
185
185
return !attribute.value .is_empty ()
186
- && element.deprecated_attribute (attribute_name).starts_with (attribute.value , case_sensitivity);
186
+ && element.attribute (attribute_name). value_or ({}). bytes_as_string_view ( ).starts_with (attribute.value , case_sensitivity);
187
187
case CSS::Selector::SimpleSelector::Attribute::MatchType::EndsWithString:
188
188
return !attribute.value .is_empty ()
189
- && element.deprecated_attribute (attribute_name).ends_with (attribute.value , case_sensitivity);
189
+ && element.attribute (attribute_name). value_or ({}). bytes_as_string_view ( ).ends_with (attribute.value , case_sensitivity);
190
190
default :
191
191
break ;
192
192
}
@@ -275,7 +275,7 @@ static inline bool matches_pseudo_class(CSS::Selector::SimpleSelector::PseudoCla
275
275
if (!matches_link_pseudo_class (element))
276
276
return false ;
277
277
auto document_url = element.document ().url ();
278
- AK::URL target_url = element.document ().parse_url (element.deprecated_attribute (HTML::AttributeNames::href));
278
+ AK::URL target_url = element.document ().parse_url (element.attribute (HTML::AttributeNames::href). value_or ({} ));
279
279
if (target_url.fragment ().has_value ())
280
280
return document_url.equals (target_url, AK::URL::ExcludeFragment::No);
281
281
return document_url.equals (target_url, AK::URL::ExcludeFragment::Yes);
0 commit comments