Created
June 20, 2019 22:51
-
-
Save NoTimeForHero/bb817ca29d43f83c5a194107317e5deb to your computer and use it in GitHub Desktop.
Сниппет для получения простого селектора XPATH по аналогии с querySelectorAll
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 characters
document.xpathSelectorAll = (selector) => { | |
const nodes = document.evaluate(selector, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); | |
return Array(nodes.snapshotLength).fill(1).map((x, id) => nodes.snapshotItem(id)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment