<?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>24325</bug_id>
          
          <creation_ts>2014-01-19 15:44:28 +0000</creation_ts>
          <short_desc>new Audio(src) need not invoke the resource selection algorithm</short_desc>
          <delta_ts>2014-01-29 02:35:32 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#the-audio-element</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>ian</cc>
    
    <cc>mike</cc>
    
    <cc>philipj</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>98750</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2014-01-19 15:44:28 +0000</bug_when>
    <thetext>Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html
Multipage: http://www.whatwg.org/C#the-audio-element
Complete: http://www.whatwg.org/c#the-audio-element
Referrer: http://www.whatwg.org/specs/web-apps/current-work/multipage/

Comment:
new Audio(src) need not invoke the resource selection algorithm

Posted from: 113.23.85.48
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.68 Safari/537.36 OPR/19.0.1326.26 (Edition Next)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98751</commentid>
    <comment_count>1</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-01-19 15:48:09 +0000</bug_when>
    <thetext>&quot;If the src argument is present, the object created must have its src content attribute set to the provided value, and the user agent must invoke the object&apos;s resource selection algorithm before returning. &quot;

Invoking the resource selection algorithm is redundant, because setting the src attribute already invokes the media element load algorithm, which invokes the resource selection algorithm as its last step.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98848</commentid>
    <comment_count>2</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-01-21 21:52:44 +0000</bug_when>
    <thetext>The constructor creates the element with the attribute already set, the attribute is never actually &quot;set&quot; in the sense that triggers the algorithm. This is similar to the situation with the parser.

Maybe I should use the word &quot;added&quot; instead of &quot;set&quot; to refer to the act of setting the attribute with setAttribute()...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98871</commentid>
    <comment_count>3</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-01-22 08:43:00 +0000</bug_when>
    <thetext>The way it&apos;s implemented in both Presto and Blink is to just set the src attribute after element creation, which triggers the logic for setting/modifying the src attribute and runs the load algorithm. The same appears to be true in Gecko:

http://hg.mozilla.org/mozilla-central/file/8f4ecbf938cd/content/html/content/src/HTMLAudioElement.cpp#l73

Yes, running the load() algorithm in this state is kind of pointless since it&apos;s equivalent to the resource selection algorithm, but hardly worth optimizing for.

Since at least 3 implementors have interpreted in the same way, maybe just go with that?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99059</commentid>
    <comment_count>4</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-01-24 23:58:34 +0000</bug_when>
    <thetext>How is that black-box distinguishable from creating the element with the attribute already set? I&apos;m not sure how comment 3 and comment 2 relate.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99097</commentid>
    <comment_count>5</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-01-26 09:59:20 +0000</bug_when>
    <thetext>This is an editorial issue since the media element load algorithm on a newly created element only invokes the resource selection algorithm.

When I filed the bug I assumed that &quot;the object created must have its src content attribute set to the provided value&quot; would trigger the steps in &quot;If a src attribute of a media element is set or changed&quot; and that also invoking the resource selection algorithm is therefore redundant.

You want to make it clearer that the element is created with the attribute already there so that the media element load algorithm is not run. I&apos;m arguing that it&apos;s easier to understand the way that it&apos;s actually implemented, by simply setting the attribute.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99098</commentid>
    <comment_count>6</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-01-26 10:00:43 +0000</bug_when>
    <thetext>(In reply to Ian &apos;Hixie&apos; Hickson from comment #2)
&gt; The constructor creates the element with the attribute already set, the
&gt; attribute is never actually &quot;set&quot; in the sense that triggers the algorithm.
&gt; This is similar to the situation with the parser.

If the parser should not trigger &quot;If a src attribute of a media element is set or changed&quot; then there is nothing that will cause media elements to start loading, since there&apos;s no longer a hook for when they are inserted into a document. Oops? (Both implementations I am familiar with treat a parser-set attribute the same way as a script-set attribute: by invoking the load algorithm.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99181</commentid>
    <comment_count>7</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-01-27 19:30:59 +0000</bug_when>
    <thetext>Wow, yeah, I totally missed that case.

(You can tell that the spec intends it the way I&apos;m describing, by the way, because it uses the _load_ algorithm when you set src=&quot;&quot;, but jumps straight to the selection algorithm when you insert a &lt;source&gt; into a dead &lt;video&gt; elmeent or create an Audio element using the constructor. The load algorithm is only useful when you&apos;re doing something and the element might already have had something loaded; in the initial case, it isn&apos;t useful and the spec skips it.)

I&apos;ve added a requirement for what happens when a media element is created with the attribute set, and rephrased the constructor comment to be non-normative, which hopefully resolves this. Reopen if you think it&apos;s still confusing, wrong, or redundant in some way. Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99182</commentid>
    <comment_count>8</comment_count>
    <who name="">contributor</who>
    <bug_when>2014-01-27 19:31:08 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r8422.
Check-in comment: Make sure newly created &lt;video&gt; and &lt;audio&gt; elements with a src=&apos;&apos; attribute actually load the media.
http://html5.org/tools/web-apps-tracker?from=8421&amp;to=8422</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99242</commentid>
    <comment_count>9</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-01-28 03:52:29 +0000</bug_when>
    <thetext>Thank you, this is an improvement.

To match &quot;If a media element is created with a src attribute&quot; I would go with &quot;If the src argument is present, the element must be created with its src content attribute set to the provided value&quot;.

You may re-resolve this bug if you don&apos;t think that&apos;s better, I can live with the current wording.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99350</commentid>
    <comment_count>10</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-01-28 20:29:04 +0000</bug_when>
    <thetext>Yeah, that&apos;s a good point. Thanks. Done.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99351</commentid>
    <comment_count>11</comment_count>
    <who name="">contributor</who>
    <bug_when>2014-01-28 20:29:47 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r8429.
Check-in comment: Improve wording of Audio constructor further.
http://html5.org/tools/web-apps-tracker?from=8428&amp;to=8429</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99382</commentid>
    <comment_count>12</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-01-29 02:35:32 +0000</bug_when>
    <thetext>LGTM!</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>