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

[whatwg] Getting .innerHTML and <pre>\n

From: Simon Pieters <zcorpan@gmail.com>
Date: Mon, 19 Mar 2007 03:43:16 +0100
Message-ID: <op.tpe0iecx7a8kvn@hp-a0a83fcd39d2>
The parsing section says that a linefeed character following a pre start  
tag token is dropped, and the syntax section says that when serializing a  
linefeed must be included if the pre starts with a linefeed. So far so  
good.

However, getting .innerHTML doesn't add the newline. Thus, if you parse  
and serialize with .innerHTML several times you keep eating linefeeds from  
pre. I think this is a problem.

Step 2 in the algorithm for getting .innerHTML, "If the child node is an  
Element", should include something along the following lines (some after  
the "Append a U+003E GREATER-THAN SIGN (>) character." paragraph):

    If the child node is an Element with a tag name pre then append a U+000A
    LINE FEED (LF) character.

This will always add the linefeed even when it's not needed, but I guess  
that's fine.

-- 
Simon Pieters
Received on Sunday, 18 March 2007 19:43:16 UTC

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