331 bytes, text/html
if |node| is a HTML paragraph with the following content model: <p>foo<br>bar</p> the result of |node.textContent()| is "foo\nbar". Given the DOM Level 3 Core prose available in http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-textContent , we have two options here : 1. <br> is really a special element and the user really wants to see the presence of that <br> reflected in textContent()'s output ; the spec is then underspecified and feedback to W3C is needed... 2. the spec is correct and nothing in the spec says <br> should be given a special behaviour. According to the prose, the textContent()'s value of <br> element is the empty string. So the result of |node.textContent()| above should be "foobar". The "\n" is here because we get the textContent of a given node through a text/plain nsIDocumentEncoder and that beast of course returns a CR for a <br> element... See |nsNode3Tearoff::GetTextContent|.
sorry for spam, please read |textContent| and not |textContent()|, it's an attribute, not a method.
What version of gecko are you seeing this in. I thought we fixed this a long time ago. If you're still seeing this please attach a testcase.
Created attachment 323876 [details] test case, see the alert containing the textContent of the paragraph (In reply to comment #2) > What version of gecko are you seeing this in. I thought we fixed this a long > time ago. > > If you're still seeing this please attach a testcase. Well, I am using a fresh nightly... Gecko/2008060407 Minefield/3.0pre See the attached test case.
sigh, nevermind, the CR in the source code after the <br> is a typo, was not supposed to be here. Sorry for that.