mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibWeb: Port Document encoding_parse_url and parse_url to Optional<URL>
This ports two more APIs away from URL::is_valid.
This commit is contained in:
parent
cfe9b7a82b
commit
22a7cd9700
Notes:
github-actions[bot]
2025-01-27 00:04:07 +00:00
Author: https://github.com/shannonbooth
Commit: 22a7cd9700
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3362
Reviewed-by: https://github.com/tcl3 ✅
26 changed files with 135 additions and 107 deletions
|
@ -466,10 +466,15 @@ static inline bool matches_pseudo_class(CSS::Selector::SimpleSelector::PseudoCla
|
|||
if (!matches_link_pseudo_class(element))
|
||||
return false;
|
||||
auto document_url = element.document().url();
|
||||
URL::URL target_url = element.document().encoding_parse_url(element.attribute(HTML::AttributeNames::href).value_or({}));
|
||||
if (target_url.fragment().has_value())
|
||||
return document_url.equals(target_url, URL::ExcludeFragment::No);
|
||||
return document_url.equals(target_url, URL::ExcludeFragment::Yes);
|
||||
auto maybe_href = element.attribute(HTML::AttributeNames::href);
|
||||
if (!maybe_href.has_value())
|
||||
return false;
|
||||
auto target_url = element.document().encoding_parse_url(*maybe_href);
|
||||
if (!target_url.has_value())
|
||||
return false;
|
||||
if (target_url->fragment().has_value())
|
||||
return document_url.equals(*target_url, URL::ExcludeFragment::No);
|
||||
return document_url.equals(*target_url, URL::ExcludeFragment::Yes);
|
||||
}
|
||||
case CSS::PseudoClass::Visited:
|
||||
// FIXME: Maybe match this selector sometimes?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue