For a chrome extension I want to ouput every word of a webpage on a newline. I found code which can provide me with all the text on a webpage:
range = document.createRange();
range.setStart(document.body,0);
range.setEnd(document.body,document.body.childNodes.length);
words = range.toString();
the variable words contains all the text of the webpage. But as far as I know, all the markup is gone because I am not handling any nodes any 
more, but just plain text. How would I go through a range word by word and be able to tell which css-properties (for example font-size) is used? And weather the word is in someway part of a <h1> tag?