Possible Duplicate:
How does jQuery’s .text() work, internally?
I'm looking for the text equivalent of innerHTML, i.e.
<p>Hello, <i>World!</i></p>
then innerText(p) should return Hello, World!.
Note: I'm aware of jQuery's text() function. I want to know how it is implemented so I can do special handling on some nodes, like inserting extra white space.