diff options
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/ParentNode.cpp | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/ParentNode.h | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/ParentNode.cpp b/Userland/Libraries/LibWeb/DOM/ParentNode.cpp index 8562c151c8..a55f7631e8 100644 --- a/Userland/Libraries/LibWeb/DOM/ParentNode.cpp +++ b/Userland/Libraries/LibWeb/DOM/ParentNode.cpp @@ -11,11 +11,11 @@ namespace Web::DOM { -RefPtr<Element> ParentNode::query_selector(const StringView& selector_text) +ExceptionOr<RefPtr<Element>> ParentNode::query_selector(StringView selector_text) { auto maybe_selectors = parse_selector(CSS::ParsingContext(*this), selector_text); if (!maybe_selectors.has_value()) - return {}; + return DOM::SyntaxError::create("Failed to parse selector"); auto selectors = maybe_selectors.value(); @@ -36,11 +36,11 @@ RefPtr<Element> ParentNode::query_selector(const StringView& selector_text) return result; } -NonnullRefPtrVector<Element> ParentNode::query_selector_all(const StringView& selector_text) +ExceptionOr<NonnullRefPtrVector<Element>> ParentNode::query_selector_all(StringView selector_text) { auto maybe_selectors = parse_selector(CSS::ParsingContext(*this), selector_text); if (!maybe_selectors.has_value()) - return {}; + return DOM::SyntaxError::create("Failed to parse selector"); auto selectors = maybe_selectors.value(); diff --git a/Userland/Libraries/LibWeb/DOM/ParentNode.h b/Userland/Libraries/LibWeb/DOM/ParentNode.h index 856c5a4597..d977cc8f7d 100644 --- a/Userland/Libraries/LibWeb/DOM/ParentNode.h +++ b/Userland/Libraries/LibWeb/DOM/ParentNode.h @@ -22,8 +22,8 @@ public: RefPtr<Element> last_element_child(); u32 child_element_count() const; - RefPtr<Element> query_selector(const StringView&); - NonnullRefPtrVector<Element> query_selector_all(const StringView&); + ExceptionOr<RefPtr<Element>> query_selector(StringView); + ExceptionOr<NonnullRefPtrVector<Element>> query_selector_all(StringView); protected: ParentNode(Document& document, NodeType type) |