Skip to content

Instantly share code, notes, and snippets.

@ujeenator
Created April 5, 2020 19:08
Show Gist options
  • Save ujeenator/7ba87c07f491076d5f27a699a57d7a67 to your computer and use it in GitHub Desktop.
Save ujeenator/7ba87c07f491076d5f27a699a57d7a67 to your computer and use it in GitHub Desktop.
function $$x (selector) {
const xpathResult = document.evaluate(selector, document, null, XPathResult.ANY_TYPE, null)
const resultArray = []
while (true) {
const item = xpathResult.iterateNext()
if (item) {
resultArray.push(item)
} else {
break
}
}
return resultArray
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment