W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2007

[whatwg] CR "entities" and LFCR

From: Anne van Kesteren <annevk@opera.com>
Date: Mon, 11 Jun 2007 16:43:43 +0200
Message-ID: <op.ttrhu5mr64w2qv@annevk-t60.oslo.opera.com>
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 is 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.

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.


-- 
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>
Received on Monday, 11 June 2007 07:43:43 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:56 UTC