<?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>24712</bug_id>
          
          <creation_ts>2014-02-18 12:37:23 +0000</creation_ts>
          <short_desc>&lt;img&gt;: Should probably not fire load if selected source is the same as the last selected source. (step 7.3)</short_desc>
          <delta_ts>2019-03-29 21:03:13 +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>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>MOVED</resolution>
          
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#update-the-image-data</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>d</cc>
    
    <cc>ian</cc>
    
    <cc>mike</cc>
    
    <cc>zcorpan</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>100799</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2014-02-18 12:37:23 +0000</bug_when>
    <thetext>Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/embedded-content-1.html
Multipage: http://www.whatwg.org/C#update-the-image-data
Complete: http://www.whatwg.org/c#update-the-image-data
Referrer: http://www.whatwg.org/specs/web-apps/current-work/multipage/

Comment:
Should probably not fire load if selected source is the same as the last
selected source. (step 7.3)

Posted from: 90.230.218.37 by simonp@opera.com
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_5_8) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.90 Safari/537.1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101289</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-02-24 23:24:46 +0000</bug_when>
    <thetext>This test shows that all browsers fire &apos;load&apos; even if it&apos;s the same source:
   http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=2846</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101290</commentid>
    <comment_count>2</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-02-24 23:25:30 +0000</bug_when>
    <thetext>(It also shows that Chrome/Safari don&apos;t seem to have a &quot;list of available images&quot;, which is interesting.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101378</commentid>
    <comment_count>3</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-02-25 19:25:39 +0000</bug_when>
    <thetext>Marking WORKSFORME. If you disagree, please reopen but with a test case demonstrating why the test above is wrong.

Actually, the test above can be misleading if the load is slow for some reason. Here&apos;s a test that has a bigger margin for handling that:
   http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=2848</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101427</commentid>
    <comment_count>4</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2014-02-26 08:38:17 +0000</bug_when>
    <thetext>The test seems right, but I think this is bad for srcset/picture, where you might end up with seemingly random &apos;load&apos; events even though the image didn&apos;t change.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101436</commentid>
    <comment_count>5</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-02-26 15:37:56 +0000</bug_when>
    <thetext>srcset=&quot;&quot; doesn&apos;t fire &apos;load&apos; if it doesn&apos;t change. There&apos;s a separate algorithm for that case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101496</commentid>
    <comment_count>6</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2014-02-27 14:12:33 +0000</bug_when>
    <thetext>Yeah, I know, so I guess it&apos;s not much of an issue for srcset itself, but for &lt;picture&gt; it&apos;s kind of an issue because there are several DOM mutations that trigger these steps. It would be nice to be able to run the steps without side-effect if the selected URL ends up being the same.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101662</commentid>
    <comment_count>7</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-02-28 21:53:00 +0000</bug_when>
    <thetext>A design that uses multiple elements for this is broken exactly because of issues like this. I pointed that out well over a year ago already, when speccing srcset.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102253</commentid>
    <comment_count>8</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-03-12 18:36:18 +0000</bug_when>
    <thetext>I don&apos;t understand the problem here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102619</commentid>
    <comment_count>9</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2014-03-19 07:32:46 +0000</bug_when>
    <thetext>I disagree that it is broken. It&apos;s more complex, I agree, and I pointed that out also, but the fix for this bug is trivial.

The bug is this:

consider &lt;img id=x src=&quot;foo.jpg&quot; crossorigin=&quot;&quot;&gt; with foo.jpg loaded, then x.crossOrigin = &apos;anonymous&apos;;. This fires a load event but the image is the same.

or &lt;img id=y srcset=&quot;foo.jpg 1x&quot;&gt; with foo.jpg loaded, then y.srcset += &apos; &apos;;.

or &lt;picture&gt;&lt;img src=&quot;foo.jpg&quot;&gt;&lt;/picture&gt; with foo.jpg loaded, then a &lt;source&gt; element with no attributes is inserted before the &lt;img&gt;.

Possibly it&apos;s not much of a problem to fire load in the above cases, it just seemed unnecessary and an area where UAs could potentially optimize if there were no observable side-effects.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102671</commentid>
    <comment_count>10</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-03-19 20:44:39 +0000</bug_when>
    <thetext>In the crossorigin case, the image might not be the same. You have to redownload it to find out.

In the srcset += &apos; &apos; case... I think it&apos;s ok to fire &apos;load&apos; again. After all, you changed the data that impacts the image selection, so you should expect the image selection to run again. If we didn&apos;t fire &apos;load&apos;, how would you know nothing had gone wrong during the image selection update?

The &lt;picture&gt; case is misguided and the element shouldn&apos;t exist in the first place, IMHO, so I have no particular comment on the specifics there.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102702</commentid>
    <comment_count>11</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2014-03-20 11:13:15 +0000</bug_when>
    <thetext>(In reply to Ian &apos;Hixie&apos; Hickson from comment #10)
&gt; In the crossorigin case, the image might not be the same. You have to
&gt; redownload it to find out.

No, the state of the attribute is the same, and the &apos;update the image data&apos; algorithm uses the state. The steps don&apos;t redownload AFAICT.

&gt; In the srcset += &apos; &apos; case... I think it&apos;s ok to fire &apos;load&apos; again. After
&gt; all, you changed the data that impacts the image selection, so you should
&gt; expect the image selection to run again. If we didn&apos;t fire &apos;load&apos;, how would
&gt; you know nothing had gone wrong during the image selection update?

I guess that&apos;s fair enough.

&gt; The &lt;picture&gt; case is misguided and the element shouldn&apos;t exist in the first
&gt; place, IMHO, so I have no particular comment on the specifics there.

You can ignore it if you like but it seems it is being implemented...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>129692</commentid>
    <comment_count>12</comment_count>
    <who name="Domenic Denicola">d</who>
    <bug_when>2019-03-29 21:03:13 +0000</bug_when>
    <thetext>At a quick glance, https://github.com/whatwg/html/issues/3709 indicates that this was specced to not fire the load event, but browsers do anyway, and we need to fix the spec to match them. Let&apos;s consolidate discussion there.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>