goto100 / xpath

DOM 3 Xpath implemention and helper for node.js
MIT License
223 stars 71 forks source link

Passing a string for a `node` failes silently #130

Closed cjbarth closed 9 months ago

cjbarth commented 1 year ago

In a recent issue discovered at xml-crypto it was discovered that if a string is passed for the node argument to select() and friends, it isn't first parsed into a Node, it just fails to find any matching nodes matching the xpath query, even though if the string were parsed into a Node first, it would have. This inconsistent behavior isn't checked for in the API. It seems that if a string is passed in the library should throw or should parse it first.

Referenced issue: https://github.com/node-saml/xml-crypto/pull/380

If desired I can create a PR to do which ever option seems better to you.

JLRishe commented 9 months ago

Thank you for bringing this up. This should be fixed in 0.0.34 (just published).

137