/* * Copyright (c) 2025, Johannes Gustafsson * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include "XPathExpression.h" #include "XPathNSResolver.h" #include "XPathResult.h" namespace Web::XPath { class XPathEvaluator : public Bindings::PlatformObject { WEB_PLATFORM_OBJECT(XPathEvaluator, Bindings::PlatformObject); GC_DECLARE_ALLOCATOR(XPathEvaluator); explicit XPathEvaluator(JS::Realm&); virtual ~XPathEvaluator() override; public: static WebIDL::ExceptionOr> construct_impl(JS::Realm&); virtual void initialize(JS::Realm&) override; WebIDL::ExceptionOr> create_expression(String const& expression, GC::Ptr resolver = nullptr); WebIDL::ExceptionOr> evaluate(String const& expression, DOM::Node const& context_node, GC::Ptr resolver = nullptr, WebIDL::UnsignedShort type = 0, GC::Ptr result = nullptr); static GC::Ref create_ns_resolver(GC::Ref node_resolver); // legacy }; }