script: Use xpath ns resolver to resolve namespace prefixes (#39321)

The xpath resolver is a function provided by the user to resolve
namespace prefixes. Previously, we were ignoring the argument.

Testing: New web platform tests start to pass
Part of https://github.com/servo/servo/issues/34527

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2025-09-16 19:25:45 +02:00 committed by GitHub
parent f3d5617349
commit 1898a740a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 164 additions and 132 deletions

View file

@ -3988,13 +3988,10 @@ impl NodeMethods<crate::DomTypeHolder> for Node {
/// <https://dom.spec.whatwg.org/#dom-node-lookupnamespaceuri>
fn LookupNamespaceURI(&self, prefix: Option<DOMString>) -> Option<DOMString> {
// Step 1.
let prefix = match prefix {
Some(ref p) if p.is_empty() => None,
pre => pre,
};
// Step 1. If prefix is the empty string, then set it to null.
let prefix = prefix.filter(|prefix| !prefix.is_empty());
// Step 2.
// Step 2. Return the result of running locate a namespace for this using prefix.
Node::namespace_to_string(Node::locate_namespace(self, prefix))
}