Created
October 28, 2019 10:29
-
-
Save navchandar/c6d484dec29b838611f0e0bafab84e54 to your computer and use it in GitHub Desktop.
Revisions
-
navchandar created this gist
Oct 28, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ function getElementsByXPath(xpath, parent) { let results=[]; let query = document.evaluate(xpath, parent||document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); for(let i = 0,length = query.snapshotLength;i < length;++i){ results.push(query.snapshotItem(i)); } return results }; items = getElementsByXPath("//*"); items.length