[whatwg] Script, style and backwards compatibility

Simon Pieters simonp at opera.com
Fri May 9 03:20:55 PDT 2008

On Fri, 09 May 2008 08:06:19 +0200, Ian Hickson <ian at hixie.ch> wrote:

> On Fri, 9 May 2008, �ke J�rvklo wrote:
>> 2008/5/9 Ian Hickson <ian at hixie.ch>:
>> >
>> > Is there really any need to escape the contents of <script>/<style> at
>> > all These days?

No, but AIUI the reaction was more like "Hey, HTML 5 doesn't say anything  
about escaping <script>/<style>, does that mean that it doesn't support  
escaped <script>/<style> and thus my pages will stop working in browsers  
implementing HTML 5?".

>> I don't know - does HTML5 currently handle situations like <script
>> type="text/javascript">document.write('</script>');</script> for
>> text/html serializations?

(The first </script> tag would close the script element.)

> Sure, you just do the same as you've always had to do:
>  <script type="text/javascript">
>   document.write('<\/script>');
>  </script>

(FWIW, this:


...works too and is allowed per HTML 5. Well, except that the written  
</script> tag then results in a parse error.)

Simon Pieters
Opera Software

More information about the whatwg mailing list