You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.
I create a framework which use Evaluate, I know how to detect if this method is available but I would like to detect if wgxpath.install.js is loaded, an if wgxpath.install() is executed, and at last, if wgxpath.install() failed or not in both case my framework call it or browser did it before to initialize my framework.
A Wiki or documentation about these issues could be fine.
The text was updated successfully, but these errors were encountered:
detect if wgxpath.install.js is loaded - Did you include the script or not? Also console.log(window.wgxpath?'wgxpath is loaded':'wgxpath is not loaded');
wgxpath.install() is executed - You can call it multiple times, im pretty sure invoking it a 2nd time wont cause any harm. Could also just do the check yourself if(!window.document.evaluate) wgxpath.install();
if wgxpath.install() failed - I cant imagine why it would fail but maybe just a try catch? I dont think catastrophic failure inside the install method is really handled
You can test if wgxpath is installed instead of the browser version by checking if the document.evaluate is native code or not.
IMO wgxpath is designed with the intent to be a fallback to document.evaluate, you should continue that design pattern by simply checking if the evaluate method exists at any point. If it does then do you really care where its coming from? As long as the xpath functions work, right?
I submit wgxpath's object include public property (or method) which give its state. As example return 0 if install() is not executed, 2 if executed, 3 if installed fine, 5 if failed
Other submit: purpose callback function as argument of install()
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi,
I create a framework which use Evaluate, I know how to detect if this method is available but I would like to detect if wgxpath.install.js is loaded, an if wgxpath.install() is executed, and at last, if wgxpath.install() failed or not in both case my framework call it or browser did it before to initialize my framework.
A Wiki or documentation about these issues could be fine.
The text was updated successfully, but these errors were encountered: