Skip to content

Instantly share code, notes, and snippets.

@kn9ts
Created May 14, 2015 07:30
Show Gist options
  • Save kn9ts/725b2603ab659791adc3 to your computer and use it in GitHub Desktop.
Save kn9ts/725b2603ab659791adc3 to your computer and use it in GitHub Desktop.
Looping through child nodes/element siblings inclusive of textual content looking for text
Array.prototype.filter.call(e.querySelector("div").childNodes, function(e) {
return 3 == e.nodeType && -1 != e.nodeValue.indexOf(":")
}).forEach(function(e) {
e = e.nodeValue.split(":", 2);
t[e[0].trim().toLowerCase()] = e[1].trim()
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment