[whatwg] Getting .innerHTML and <pre>\n
Simon Pieters
zcorpan at gmail.com
Sun Mar 18 19:43:16 PDT 2007
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
More information about the whatwg
mailing list