W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2013

[whatwg] Spec ambiguity and Firefox bug for newlines following <pre> and <textarea>

From: Michael Day <mikeday@yeslogic.com>
Date: Tue, 14 May 2013 12:36:01 +1000
Message-ID: <5191A311.9030209@yeslogic.com>
To: whatwg@whatwg.org

If a newline character token follows a <pre> or <textarea> start tag, it 
is supposed to be ignored as an authoring convenience.

However, what if a NULL character token gets in the way? Consider these 
two cases, where "NULL" represents a literal U+0000 character:



For textarea, the tokenizer will be in the rcdata state, which generates 
replacement character (U+FFFD) tokens for each NULL. So the newline will 
not be the next token following the start tag, and should not be 
ignored. Chrome gets this right, Firefox get this wrong, and displays 
the replacement character *and* strips the newline.

For pre, the tokenizer will be in the data state, which emits NULL 
characters as-is. The NULL character token is then ignored by the "in 
body" insertion mode. Does this mean it doesn't count as the next token 
after the start tag? Both browsers seem to think so.

In general, the concept of "next token" is not well defined; in fact I 
don't think it is ever explicitly defined in the spec. If a token is 
ignored, is it still the next token?

Since this concept is only used for the specific case of ignoring 
newlines at the start of <pre>, <listing>, and <textarea>, perhaps a 
better mechanism could be found to describe how it should work.

Best regards,


Prince: Print with CSS!
Received on Tuesday, 14 May 2013 02:37:04 UTC

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