mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:08:10 +00:00
LibWeb: Use lowercase type selectors to match against html elements
Previously we would fail to match a selector like "NAV" against a <nav> html element. Note that the strings must be identical in XML Documents.
This commit is contained in:
parent
6805baeedd
commit
48c54e6796
1 changed files with 3 additions and 0 deletions
|
@ -341,6 +341,9 @@ static inline bool matches(CSS::Selector::SimpleSelector const& component, DOM::
|
|||
case CSS::Selector::SimpleSelector::Type::Class:
|
||||
return element.has_class(component.name());
|
||||
case CSS::Selector::SimpleSelector::Type::TagName:
|
||||
// See https://html.spec.whatwg.org/multipage/semantics-other.html#case-sensitivity-of-selectors
|
||||
if (is<HTML::HTMLElement>(element) && element.document().document_type() != DOM::Document::Type::XML)
|
||||
return component.name().equals_ignoring_case(element.local_name());
|
||||
return component.name() == element.local_name();
|
||||
case CSS::Selector::SimpleSelector::Type::Attribute:
|
||||
return matches_attribute(component.attribute(), element);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue