Skip to content

Instantly share code, notes, and snippets.

@iddan
Created August 2, 2016 05:57
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 iddan/928bc9813e0f6afe15daf606071eb6c2 to your computer and use it in GitHub Desktop.
Save iddan/928bc9813e0f6afe15daf606071eb6c2 to your computer and use it in GitHub Desktop.
XPath Evaluation Iterator
function* evaluateElement (el, xpath) {
let evaluation = document.evaluate(xpath, el);
let iterated;
while (iterated = evaluation.iterateNext()) {
yield iterated;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment