W3C home > Mailing lists > Public > public-html-comments@w3.org > April 2010

Re: Restrictions for contents of script elements

From: Simon Pieters <simonp@opera.com>
Date: Wed, 14 Apr 2010 09:34:50 +0200
To: "Julien Royer" <eldebaran@gmail.com>, "Ian Hickson" <ian@hixie.ch>
Cc: public-html-comments@w3.org
Message-ID: <op.va45z9ggidj3kv@simon-pieterss-macbook.local>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 1 June 2011 00:14:02 GMT