-
Notifications
You must be signed in to change notification settings - Fork 41
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
Fix DocumentFragment XPath evaluate #1242
Conversation
If the error is not caught, the polling doesn't early exit and can lead to unexpected time outs with no context or errors on what went wrong.
7ce2046
to
da195b9
Compare
XPath and evaluate are not available on DocumentFragments. This change adds a function to allow the DocumentFragment to be converted into a document and then be able to run the XPath evaluate against it.
When a DocumentFragment is found in XPathQueryEngine, convert it to a document first before running evaluate with XPath against it. evaluate and XPath do not work on DocumentFragments.
da195b9
to
9fe9efd
Compare
aef50c3
to
54f0579
Compare
54f0579
to
19780e2
Compare
19780e2
to
9f20bf1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice fix! Could you explain (or add comments) the changes to the injected_script.js
? Can you help me understand the goals of these changes and how they all work? (I don't have specific questions to ask because I need some general guidance to understand it. I understand that we're "somehow" converting DocumentFragment to Document).
I've tried to tidy up the comments so that it makes a bit more sense, as well as adding more context. The details on the errors can be found in the issue itself (including the comments). Let me know if this helps or not. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the great explanations 🙇 Now, it's super clear for me.
What?
This adds javascript code to convert a
DocumentFragment
into aDocument
.Why?
DocumentFragment
s do not implementevaluate
and so do not work withXPath
selectors. When aDocumentFragment
is encountered it will convert that to aDocument
so thatevalaute
withXPath
selectors can be performed.Checklist
Related PR(s)/Issue(s)
Updates: #1243