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
Inconsistent behaviour across browsers (Chrome / Firefox) #605
Comments
Hello Ilaria, This is because of namespaces. If no namespace resolver is passed, I make a default one. This is defined at https://github.com/FontoXML/fontoxpath/blob/master/src/evaluationUtils/buildEvaluationContext.ts#L41. In Chrome, this does the following:
In FireFox, I get this:
However, all elements are in that namespace. Since I do not really have a stable way to determine that for these queries a user means to point the default prefix to the HTML URI, I'm a bit stuck. If you have any better ideas I'm happy to listen! The easiest way to always make this work is by passing a namespace resolver. Something like this should fix it:
Of course, wrapping FontoXPath in a new function makes it easier to use:
Kind regards, Martin |
It looks like Firefox' behavior is wrong in this case compared to the DOM spec. There's a 9 years old bug open for it: https://bugzilla.mozilla.org/show_bug.cgi?id=1061578 |
Hello Martin, Best, |
I am using fontoxpath in a project and noticed some inconsistent behaviors between Chrome and Firefox.
On Chrome the queries
//div
and//*[name()='div']
find and match all the divs in the document.On Firefox, fontoxpath with the very simple query
//div
, returns an empty array, while with the more convoluted query//*[name()='div']
matches the divs.I built a small project where the issue can be reproduced, you can find more details about the issue in the README and test yourself:
https://github.com/ilariaschinina/fontoxpath-test-project
Let me know if I can provide further details or clarifications.
Best,
Ilaria
The text was updated successfully, but these errors were encountered: