Re: Restrictions for contents of script elements

On Tue, 13 Apr 2010 22:03:42 +0200, Ian Hickson <ian@hixie.ch> wrote:

> On Tue, 13 Apr 2010, Julien Royer wrote:
>>
>> I don't understand the restrictions defined for the content of script
>> elements:
>> http://dev.w3.org/html5/spec/semantics.html#restrictions-for-contents-of-script-elements
>>
>> script being a raw-text element, it can't contain the "script-end"
>> production
>> (http://www.w3.org/TR/html5/syntax.html#cdata-rcdata-restrictions).
>>
>> Why do we need such a complex ABNF for the content of script elements?
>
> Unfortunately for historical reasons the parsing rules for <script>  
> blocks
> are really obscure and can lead to some really strange results. For
> example:
>
>  "<script><script></script>" closes at the </script>
>  "<script><!--</script>" closes at the </script>
>  "<script><!--<script></script></script>" closes at the _second_  
> </script>
>
> Since we're basically stuck living with these silly rules (they're needed
> to parse legacy documents), we have the complex ABNF you refer to to
> prevent authors from trying to write stuff that doesn't work right.

But the rule for raw text elements in #writing already bans the third  
example, because it contains "</script>".

If we want to make "<script><!--<script></script>--></script>" conforming,  
then script shouldn't be a raw text element in #writing.

-- 
Simon Pieters
Opera Software

Received on Wednesday, 14 April 2010 07:35:38 UTC