Skip to content

Instantly share code, notes, and snippets.

@stryju
Created April 8, 2013 15:43
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 stryju/5337802 to your computer and use it in GitHub Desktop.
Save stryju/5337802 to your computer and use it in GitHub Desktop.
var comments = [];
function digDeeper( el, i ){
if ( el.nodeType === 8 ){
comments.push( el.nodeValue.replace( /^\s*|\s*$/g, '' ));
return;
}
if ( ! el || ! el.childNodes || ! el.childNodes.length ){
return;
}
for ( i = el.childNodes.length; i--; ){
digDeeper( el.childNodes[ i ]);
}
}
digDeeper( document );
console.warn( comments );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment