<?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>12715</bug_id>
          
          <creation_ts>2011-05-21 06:03:55 +0000</creation_ts>
          <short_desc>When used to include data blocks (as opposed to scripts), the data must be embedded inline</short_desc>
          <delta_ts>2012-01-13 06:03:42 +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>LC1 HTML5 spec</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#the-script-element</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>hsivonen</cc>
    
    <cc>ian</cc>
    
    <cc>mike</cc>
    
    <cc>piersh</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>48671</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2011-05-21 06:03:55 +0000</bug_when>
    <thetext>Specification: http://www.whatwg.org/specs/web-apps/current-work/
Section: http://www.whatwg.org/specs/web-apps/current-work/#the-script-element

Comment:
When used to include data blocks (as opposed to scripts), the data must be
embedded inline

Posted from: 72.52.65.50
User agent: Mozilla/5.0 (Windows NT 6.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>49457</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-06-10 22:44:00 +0000</bug_when>
    <thetext>EDITOR&apos;S RESPONSE: This is an Editor&apos;s Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Did Not Understand Request
Change Description: no spec change
Rationale: I don&apos;t understand. Could you elaborate? Why is this a bug?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>53616</commentid>
    <comment_count>2</comment_count>
    <who name="Michael[tm] Smith">mike</who>
    <bug_when>2011-08-04 05:15:45 +0000</bug_when>
    <thetext>mass-move component to LC1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59573</commentid>
    <comment_count>3</comment_count>
    <who name="">piersh</who>
    <bug_when>2011-11-03 17:29:05 +0000</bug_when>
    <thetext>Is there some reason that this functionality was removed from html?

It seems to me to be a shame to disallow non-inline, non-&apos;text/javascript&apos; script blocks.

I&apos;d like to be able to do this:

    &lt;script id=&quot;fragmentShader&quot; type=&quot;x-shader/x-fragment&quot; src=&quot;fragmentShader.cg&quot; onload=&quot;compileShader(this);&quot;/&gt;

But the spec doesn&apos;t allow it. Instead I have to jump through XHR hell just to load some text. :(</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59610</commentid>
    <comment_count>4</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2011-11-04 06:25:01 +0000</bug_when>
    <thetext>The use case is supported (search for &quot;data block&quot; in the spec around &lt;script&gt;). However, type=&quot;&quot; must contain a valid MIME type, and x-shader/x-fragment is not a valid MIME type. You could mint something like text/x-fragment-shader, or use application/octet-stream which is valid and is guaranteed to not be interpreted as a scripting language by UAs.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59612</commentid>
    <comment_count>5</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2011-11-04 06:32:15 +0000</bug_when>
    <thetext>Oh wait. &quot;data block&quot; needs the data embedded inline. Having it external with src=&quot;&quot; won&apos;t work since the script isn&apos;t fetched if type is not supported. IIRC, browsers converged on not fetching such scripts for perf reasons. However, I guess a new attribute could be minted to explicitly enable fetching external (but same-origin) data blocks and making them available to scripts for reading, as an alternative to XHR.

Why is XHR not good enough?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59637</commentid>
    <comment_count>6</comment_count>
    <who name="">piersh</who>
    <bug_when>2011-11-04 20:01:07 +0000</bug_when>
    <thetext>(In reply to comment #4)
&gt; The use case is supported (search for &quot;data block&quot; in the spec around
&gt; &lt;script&gt;). However, type=&quot;&quot; must contain a valid MIME type, and
&gt; x-shader/x-fragment is not a valid MIME type. You could mint something like
&gt; text/x-fragment-shader, or use application/octet-stream which is valid and is
&gt; guaranteed to not be interpreted as a scripting language by UAs.

I&apos;m sorry, but &quot;x-shader/x-fragment&quot; IS a valid MIME type, and acceptable in this usage, according to

  http://www.w3.org/TR/html5/scripting-1.html#attr-script-type
  http://www.w3.org/TR/html5/infrastructure.html#valid-mime-type
  http://www.ietf.org/rfc/rfc2616.txt, section 3.7


The MIME type is not the issue.

The issue is that for some reason (that isn&apos;t given in the spec), external script blocks are only allowed for &quot;text/javascript&quot;

&gt; browsers converged on not fetching such scripts for perf reasons

Doesn&apos;t the &apos;defer&apos; attribute, and &apos;onload&apos; events cover this? besides, for synchronous cases, separating fetch from parse solves most of the perceived performance issues.

&gt; Why is XHR not good enough?

XHR works, but it&apos;s a programmatic one - an ugly one at that.

What I&apos;m suggesting is that if a seemingly arbitrary restriction is lifted (modulo security considerations) then a simple, declarative solution reveals itself.


Imagine if the same restriction applied to &lt;img&gt;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59663</commentid>
    <comment_count>7</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2011-11-05 23:07:28 +0000</bug_when>
    <thetext>Reopening to let the editor consider the request.

(In reply to comment #6)
&gt; Doesn&apos;t the &apos;defer&apos; attribute, and &apos;onload&apos; events cover this? besides, for
&gt; synchronous cases, separating fetch from parse solves most of the perceived
&gt; performance issues.

The problem is that browsers don&apos;t want to download a script that won&apos;t be run. (Some pages use bogus type=&quot;&quot; and don&apos;t use it as a &quot;data block&quot;, and there it&apos;s just wasted bandwidth and time.)

&gt; Imagine if the same restriction applied to &lt;img&gt;.

&lt;img&gt; can&apos;t be used for data blocks, so I don&apos;t follow.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60859</commentid>
    <comment_count>8</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-12-02 23:13:15 +0000</bug_when>
    <thetext>I don&apos;t understand what I&apos;m supposed to be considering here.

Can you restate the problem succinctly? What is the use case?

If the use case is &quot;I want to download some data file to use in my script&quot;, then that&apos;s what XMLHttpRequest is for, why is it insufficient?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61108</commentid>
    <comment_count>9</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-12-07 20:04:44 +0000</bug_when>
    <thetext>EDITOR&apos;S RESPONSE: This is an Editor&apos;s Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Did Not Understand Request
Change Description: no spec change
Rationale: see commnent 8</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62278</commentid>
    <comment_count>10</comment_count>
    <who name="">piersh</who>
    <bug_when>2012-01-04 18:41:23 +0000</bug_when>
    <thetext>why is XMLHttpRequest not sufficient?

1) it only works over HTTP. other URL schemes aren&apos;t supported.
2) it is imperative-style, as opposed to declarative.

HTML is a markup language, not a programming language.

the use case is in comment #3
  https://www.w3.org/Bugs/Public/show_bug.cgi?id=12715#c3

consider that simple one-liner compared to the XHR nightmare you have to jump through. what happens if you want to run the content from a non-http url scheme (file://) ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62294</commentid>
    <comment_count>11</comment_count>
    <who name="Henri Sivonen">hsivonen</who>
    <bug_when>2012-01-05 08:13:47 +0000</bug_when>
    <thetext>(In reply to comment #10)
&gt; why is XMLHttpRequest not sufficient?
&gt; 
&gt; 1) it only works over HTTP. other URL schemes aren&apos;t supported.

Incorrect. XMLHttpRequest in neither restricted to XML nor HTTP.

&gt; what happens if you want to run the content from a non-http url scheme (file://) ?

In Firefox, if the file:// URL is considered to be same-origin with the document that uses XHR, XHR is allowed to GET the file:// URL.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62641</commentid>
    <comment_count>12</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-01-13 01:15:31 +0000</bug_when>
    <thetext>EDITOR&apos;S RESPONSE: This is an Editor&apos;s Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Rejected
Change Description: no spec change
Rationale: see comment 11.

The proposal in comment 3 doesn&apos;t say how the script would get to the data. I don&apos;t see why it would end up being any less code than using XHR.

I also don&apos;t see any advantage to this being declarative rather than imperative, since we&apos;re talking about ways to get data to a script.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62651</commentid>
    <comment_count>13</comment_count>
    <who name="">piersh</who>
    <bug_when>2012-01-13 06:03:42 +0000</bug_when>
    <thetext>&gt; The proposal in comment 3 doesn&apos;t say how the script would get to the data.

the &lt;script&gt; block is a node in the DOM and it&apos;s content can be accessed using the DOM API - as was shown in comment #3. The spec, however only allows the use of inline script blocks. All I&apos;m suggesting is that this seemingly arbitrary restriction be lifted, or at the very least justified.

&gt; I
&gt; don&apos;t see why it would end up being any less code than using XHR.

Again, please see comment #3. Maybe you missed it because it&apos;s so simple. That&apos;s the point, somewhat.

This is the entirety of HTML code required to load an external shader definition and call the &apos;compileShader&apos; function when the load has completed. The &apos;defer&apos; or &apos;async&apos; attributes could be used here to control timing.

I&apos;m not going to attempt to post the XHR code. I&apos;d probably get it wrong without any means to verify its correctness.

&gt; I also don&apos;t see any advantage to this being declarative rather than
&gt; imperative, since we&apos;re talking about ways to get data to a script.

This isn&apos;t about getting data to a script. It&apos;s about executing script on data.

Why is declarative better than imperative? I dunno, ask Tim. This is htMl after all...</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>