[whatwg] CR "entities" and LFCR

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