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

Ian Hickson ian at hixie.ch
Mon Jun 18 22:34:06 PDT 2007


On Mon, 19 Mar 2007, Simon Pieters wrote:
>
> 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.

Fixed.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list