Bug 156285 - Newlines lost in .innerHTML serialization of <pre> when first character is a newline
Summary: Newlines lost in .innerHTML serialization of <pre> when first character is a ...
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-06 03:43 PDT by Simon Pieters
Modified: 2016-09-23 07:08 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Pieters 2016-04-06 03:43:52 PDT
The HTML spec says

> If current node is a pre, textarea, or listing element, and the first child node of the element, if any, is a Text node whose character data has as its first character a U+000A LINE FEED (LF) character, then append a U+000A LINE FEED (LF) character.

https://html.spec.whatwg.org/#html-fragment-serialisation-algorithm

This is because otherwise it doesn't round-trip correctly if the data starts with a LF.

See https://github.com/whatwg/html/issues/944
Comment 1 Simon Pieters 2016-09-23 07:08:35 PDT
https://github.com/whatwg/html/pull/1815