-
-
Notifications
You must be signed in to change notification settings - Fork 905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug] Nokogiri::XML::Document#css no longer matches namespaced XML attributes #3411
Comments
It seems I have two options. Option 1 is to drop namespaces: doc.remove_namespaces! Option 2 is to register the namespaces and update the query: namespaces = {
'default' => 'http://a9.com/-/spec/opensearch/1.1/',
'moz' => 'http://www.mozilla.org/2006/browser/search/'
}
doc.xpath('//default:OpenSearchDescription/*', namespaces) |
@stanhu Interesting! I'll take a look as soon as I can. |
Behavior change was introduced in 179d74d:
So this seems like it's a bug, I'll fix it. |
Proposed fix at #3413 |
…3413) **What problem is this PR intended to solve?** When performing a CSS selector query, an XML document's root namespace declarations are injected into the XPathVisitor, and the default namespace is applied to any non-namespaced element in the resulting xpath query. However, the wildcard selector "*" should not have this namespace applied. This regressed in v1.17.0 with 179d74d. Fixes #3411 **Have you included adequate test coverage?** Yes. **Does this change affect the behavior of either the C or the Java implementations?** N/A
When performing a CSS selector query, an XML document's root namespace declarations are injected into the XPathVisitor, and the default namespace is applied to any non-namespaced element in the resulting xpath query. However, the wildcard selector "*" should not have this namespace applied. This regressed in v1.17.0 with 179d74d. Fixes #3411
Backporting to v1.18.x for a bugfix release: #3414 |
Please describe the bug
I'm not sure if this is a bug, but I noticed when trying to upgrade from nokogiri v1.16.8 to v1.17.2, that this behavior changed:
In nokogiri v1.16.8, this returned:
In nokogiri v1.17.2,
SearchForm
is excluded:I see three commits in
lib/nokogiri/xml/searchable.rb
that might be relevant:Is this intentional? Do I need to change my selector to handle this?
The text was updated successfully, but these errors were encountered: