<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>22233</bug_id>
          
          <creation_ts>2013-06-02 12:57:23 +0000</creation_ts>
          <short_desc>[HTML]: I can&apos;t find the rules which specify real-world parsing of &lt;body&gt;&lt;script&gt;&amp;amp;</short_desc>
          <delta_ts>2013-06-07 13:29:34 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML WG</product>
          <component>HTML5 spec</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Alan Jenkins">alan.christopher.jenkins</reporter>
          <assigned_to name="This bug has no owner yet - up for the taking">dave.null</assigned_to>
          <cc>bzbarsky</cc>
    
    <cc>hsivonen</cc>
    
    <cc>mike</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
          
          <qa_contact name="HTML WG Bugzilla archive list">public-html-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>88549</commentid>
    <comment_count>0</comment_count>
    <who name="Alan Jenkins">alan.christopher.jenkins</who>
    <bug_when>2013-06-02 12:57:23 +0000</bug_when>
    <thetext>AFAICS the tokenizer is only switched to &quot;script data state&quot; from the &quot;in head&quot; insertion mode.

However real-world browsers also switch to &quot;script data state&quot; from &lt;script&gt; inside &lt;body&gt;.  E.g. Firefox 21.0 with this test page:

&lt;!doctype html&gt;
&lt;body&gt;&lt;!-- behaviour is identical if &lt;body&gt; is removed --&gt;
&lt;script&gt;alert(&apos;&amp;amp;&apos;)&lt;/script&gt;

The result is &quot;&amp;amp;&quot;.  But AFAICS the spec implies this (non-conforming) page should result in &quot;&amp;&quot;.  (Which violates the principle of least surprise, at least).

My understanding was that this was the real-world behaviour on all major browsers.  And if the spec is in variation then no major browser is conforming, which is an obstacle to standardization.

Am I right about the behaviour specified by HTML5?  And major browsers other than Firefox?  If so, does the spec need to be changed?

This thought was provoked after looking at how &lt;svg&gt;&lt;script&gt; works in HTML syntax.  http://security.stackexchange.com/questions/36701/why-does-this-xss-vector-work-in-svg-but-not-in-html

I recently came across this particular tag soup in ci-Bonfire.  Example page http://eposure.com/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>88904</commentid>
    <comment_count>1</comment_count>
    <who name="Henri Sivonen">hsivonen</who>
    <bug_when>2013-06-07 13:29:34 +0000</bug_when>
    <thetext>&quot;In body&quot; says:
&gt; A start tag token whose tag name is one of: &quot;base&quot;, &quot;basefont&quot;, &quot;bgsound&quot;, &quot;link&quot;, &quot;meta&quot;, &quot;noframes&quot;, &quot;script&quot;, &quot;style&quot;, &quot;title&quot;
&gt;
&gt;    Process the token using the rules for the &quot;in head&quot; insertion mode.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>