Re: Issues arising from not reparsing

On Sun, 11 Oct 2009 11:34:32 +0200, Ian Hickson <ian@hixie.ch> wrote:

> On Tue, 6 Oct 2009, Simon Pieters wrote:
>> On Mon, 05 Oct 2009 18:34:42 +0200, Simon Pieters <simonp@opera.com>  
>> wrote:
>> > Proposal #3 in http://wiki.whatwg.org/wiki/CDATA_Escapes reads:
>> >
>> >     For script, when in an escaped text span, set a flag after having  
>> seen
>> >     "<script" followed by whitespace or slash or greater-than.  
>> "</script"
>> >     followed by whitespace or slash or greater-than only closes the  
>> element
>> >     if the flag is not set, and otherwise emits the text and resets  
>> the
>> >     flag. Exiting an escaped text span also resets the flag.
>>
>> Upon further reflection, it seems unnecessary to check the next  
>> character
>> after "<script", so I've changed the proposal to read:
>>
>>    For script, when in an escaped text span, set a flag after having  
>> seen
>>    "<script". "</script" followed by whitespace or slash or greater-than
>>    only closes the element if the flag is not set, and otherwise emits  
>> the
>>    text and resets the flag. Exiting an escaped text span also resets  
>> the
>>    flag.
>
> So the proposed changes to the spec are:
>
>  * in the Data state, while the escape flag is true, if you consume "t"
>    and the previous characters were "<scrip", then set the inner escape
>    flag to true also,

ASCII-case-insensitively.

>  * whenever the escape flag is set to false, also set the inner-escape
>    flag to false,
>
>  * for "<" in the Data state, you always switch to the Tag open state,  
> and
>
>  * in the RCDATA/RAWTEXT bit at the top of the Close tag open state, add
>    to the end of the first paragraph "or they are but the escape flag and
>    the inner-escape flag are both true"

* the inner-escape flag should be reset in <script><!-- <script </script>  
...

* the outer-escape flag should be reset in <script><!-- </script>


> ...?

This seems to affect all RCDATA/RAWTEXT elements. The proposal is only  
intended to affect <script> elements.


It seems plausible that there are pages with

<style><!--
...
</style>

(and I seem to remember having seen such pages when researching comment  
reparsing but I can't find the data right now) so it would be good to make  
the end tag close style for that example.

It would be weird to have

<style><!--
/* a comment that mentions <script> */
...
</style>

make the </style> tag be ignored.


I tentatively suggest making the escape flags only have an effect for  
<script> elements.

-- 
Simon Pieters
Opera Software

Received on Sunday, 11 October 2009 10:10:51 UTC