LibWeb/CSS: Remove an unnecessary ParsingContext constructor

Anywhere we have a Node, we have a Document. So just use that.
This commit is contained in:
Sam Atkins 2025-02-04 15:59:56 +00:00
commit ca5dee4c55
Notes: github-actions[bot] 2025-02-06 16:49:02 +00:00
4 changed files with 3 additions and 12 deletions

View file

@ -744,7 +744,7 @@ GC::Ptr<ShadowRoot> Element::shadow_root_for_bindings() const
WebIDL::ExceptionOr<bool> Element::matches(StringView selectors) const
{
// 1. Let s be the result of parse a selector from selectors.
auto maybe_selectors = parse_selector(CSS::Parser::ParsingContext(static_cast<ParentNode&>(const_cast<Element&>(*this))), selectors);
auto maybe_selectors = parse_selector(CSS::Parser::ParsingContext(document()), selectors);
// 2. If s is failure, then throw a "SyntaxError" DOMException.
if (!maybe_selectors.has_value())
@ -764,7 +764,7 @@ WebIDL::ExceptionOr<bool> Element::matches(StringView selectors) const
WebIDL::ExceptionOr<DOM::Element const*> Element::closest(StringView selectors) const
{
// 1. Let s be the result of parse a selector from selectors.
auto maybe_selectors = parse_selector(CSS::Parser::ParsingContext(static_cast<ParentNode&>(const_cast<Element&>(*this))), selectors);
auto maybe_selectors = parse_selector(CSS::Parser::ParsingContext(document()), selectors);
// 2. If s is failure, then throw a "SyntaxError" DOMException.
if (!maybe_selectors.has_value())