[whatwg] CR "entities" and LFCR

On 6/11/07, Anne van Kesteren <annevk at opera.com> wrote:
> On Fri, 08 Jun 2007 20:53:54 +0200, Michael A. Puls II
> <shadow2531 at gmail.com> wrote:
> > I believe Boris told me for FF, newline normalization (including
> > entities) is only done for parsing into the DOM and that any setting
> > of a string property in JS does zero newline normalization. So, if you
> > set \n\r, \n\r is stored as-is (which we visually equivalent as having
> > 2 newlines) and if there needs to be any normalization, it needs to be
> > done by the author of the JS code.
>
> Some further testing shows that for layout purposes Firefox uses \n as a
> line delimiter in their white space algorithm and \r is simply ignored.
> Internet Explorer uses \r as line delimiter and \n as _space_. Opera uses
> both, but \r\n is a single line break.

Ah, I see.

> http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E%0D%0A%3Cpre%3Etest%3Cscript%3E%20document.getElementsByTagName%28%22pre%22%29%5B0%5D.firstChild.data%20%3D%20%22x%5Cr%5Cnx%22%20%3C/script%3E%3C/pre%3E%0D%0A
>
> can be used for playing with this.

Check what FF does for "x\n\r\nx" and compare to the others. It seems
FF doesn't ignore the \r in this case and doesn't consider it part of
a newline pair, so you get 3 newlines.


-- 
Michael

Received on Monday, 11 June 2007 14:02:12 UTC