Skip to content

Instantly share code, notes, and snippets.

@Kreijstal
Last active January 13, 2021 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kreijstal/494d1610b1b7745b7598b08055bc5fef to your computer and use it in GitHub Desktop.
Save Kreijstal/494d1610b1b7745b7598b08055bc5fef to your computer and use it in GitHub Desktop.
Use xpath but without so much trash
//sersly
((a)=>{let xPathResult = document.evaluate(a, document, null, XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null );
const nodes = [];
let node = xPathResult.iterateNext();
while (node) {
nodes.push(node);
node = xPathResult.iterateNext();
};
return nodes})('//input')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment