<?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>23443</bug_id>
          
          <creation_ts>2013-10-05 14:55:11 +0000</creation_ts>
          <short_desc>The rendering requirement for img elements with src without alt might not be web-compatible</short_desc>
          <delta_ts>2013-11-13 22:42:27 +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>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugzilla.mozilla.org/show_bug.cgi?id=922931</see_also>
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html#images-0</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Masatoshi Kimura">VYV03354</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>bzbarsky</cc>
    
    <cc>ian</cc>
    
    <cc>mike</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>94368</commentid>
    <comment_count>0</comment_count>
    <who name="Masatoshi Kimura">VYV03354</who>
    <bug_when>2013-10-05 14:55:11 +0000</bug_when>
    <thetext>See https://bugzilla.mozilla.org/show_bug.cgi?id=922931 for details.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94369</commentid>
    <comment_count>1</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2013-10-05 15:17:59 +0000</bug_when>
    <thetext>In particular, if you have &lt;img src=&quot;whetever&quot; width=1 height=1&gt; then displaying that as a non-replaced inline with any sort of visible indicator child will affect things like line heights and vertical alignment in ways that the actual image would not.  I don&apos;t believe there is any UA today that does that sort of thing right now: Gecko shows an empty non-replaced element, and other UAs use a replaced element.

We plan to move Gecko to using a replaced element in this specific case as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94426</commentid>
    <comment_count>2</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-10-07 22:26:40 +0000</bug_when>
    <thetext>This is intentionally quirks-mode only, specifically modeled after Firefox.

It would be really sad if we had to break this.

Can you elaborate on why this isn&apos;t Web-compatible in no-quirks mode?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94432</commentid>
    <comment_count>3</comment_count>
    <who name="Masatoshi Kimura">VYV03354</who>
    <bug_when>2013-10-07 22:57:07 +0000</bug_when>
    <thetext>(In reply to Ian &apos;Hixie&apos; Hickson from comment #2)
&gt; This is intentionally quirks-mode only

Hm, but the actual spec doesn&apos;t say so.

http://www.whatwg.org/specs/web-apps/current-work/multipage/embedded-content-1.html#the-img-element
&gt; If the src attribute is set and the alt attribute is not
&gt; 
&gt;     The image might be a key part of the content, and there is no textual
&gt; equivalent of the image available.

http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html#rendering
&gt; When an img element might be a key part of the content, but neither the
&gt; image nor any kind of alternative text is available, and the user agent
&gt; does not expect this to change, the element is expected to be treated as
&gt; a non-replaced phrasing element whose content is an icon indicating that
&gt; an image is missing.

No spec text is saying about the rendering mode in this case.
Also, it (displaying a non-replaced inline with visible indicator child) is not what Gecko was doing in no-quirks mode (displaying an empty non-replaced element) or in quirks mode (displaying a replaced element).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94471</commentid>
    <comment_count>4</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2013-10-08 15:35:36 +0000</bug_when>
    <thetext>&gt; This is intentionally quirks-mode only, specifically modeled after Firefox.

No, the spec text being quoted here is about standards mode.  Specifically, about the behavior of &lt;img src&gt; with no &quot;alt&quot; set at all and a broken image in standards mode.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94519</commentid>
    <comment_count>5</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-10-09 22:20:34 +0000</bug_when>
    <thetext>Right, what I mean is that the behaviour depends on the mode. In quirks mode we have the old-style behaviour of being an inline-block and generally putting the image first. In the no-quirks mode we have the better behaviour of putting the text first, on the assumption that this will encourage more accessible design.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94528</commentid>
    <comment_count>6</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2013-10-10 00:13:06 +0000</bug_when>
    <thetext>My point is that the spec&apos;s requirement for the case I described in comment 1 gives it a height a lot larger than 1px in standards mode.  No UA implements that (Gecko treats it as an empty non-replaced element, while others treat it as a replaced element with height 1px), and I expect it would break web pages to do so.

Gecko&apos;s current plan is to switch to the rendering other UAs have, which is using a replaced element, for this specific case (src set, alt not set at all, image broken) in standards mode.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94530</commentid>
    <comment_count>7</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-10-10 00:32:12 +0000</bug_when>
    <thetext>(In reply to Masatoshi Kimura from comment #3)
&gt; (In reply to Ian &apos;Hixie&apos; Hickson from comment #2)
&gt; &gt; This is intentionally quirks-mode only
&gt; 
&gt; Hm, but the actual spec doesn&apos;t say so.

It&apos;s not super clear, you&apos;re right, but in the Images rendering section the second paragraph describes the behaviour for quirks mode. Everything else is for the no-quirks (and limited-quirks) mode(s). I should make that clearer.


(In reply to Boris Zbarsky from comment #6)
&gt; My point is that the spec&apos;s requirement for the case I described in comment
&gt; 1 gives it a height a lot larger than 1px in standards mode.  No UA
&gt; implements that (Gecko treats it as an empty non-replaced element, while
&gt; others treat it as a replaced element with height 1px), and I expect it
&gt; would break web pages to do so.

I don&apos;t understand. If Gecko treats it as an empty non-replaced element, why is that less height than what the spec gives it? The only difference is that the spec also includes an icon, right? But that doesn&apos;t change the height of the element. Is it the width you are concerned about?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94531</commentid>
    <comment_count>8</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2013-10-10 00:48:02 +0000</bug_when>
    <thetext>&gt; But that doesn&apos;t change the height of the element.

Unfortunately, it does.  Compare the layout of these two divs:

  &lt;!DOCTYPE html&gt;
  &lt;style&gt;div { border: 1px solid green }&lt;/style&gt;
  &lt;div&gt;&lt;span&gt;
  &lt;/span&gt;&lt;/div&gt;
  &lt;hr&gt;
  &lt;div&gt;&lt;span&gt;
    &lt;span style=&quot;display: inline-block; height: 10px; width: 10px&quot;&gt;&lt;/span&gt;
  &lt;/span&gt;&lt;/div&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94535</commentid>
    <comment_count>9</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-10-10 02:09:30 +0000</bug_when>
    <thetext>Oh, because there&apos;s nothing in the rest of the line box, so the inline gets collapsed away, ok.

Rather than breaking all the cases, how about limiting this behaviour specifically to these cases?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94538</commentid>
    <comment_count>10</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2013-10-10 02:33:53 +0000</bug_when>
    <thetext>That would be a huge PITA to implement: you would need to change your box type based on what other boxes are in your line box.  That&apos;s not a reasonable thing to do, I believe.

I don&apos;t think using a sized box for the &quot;no alt attribute&quot; case would break anything, honestly.  The usual argument for not doing that, which is that the alt text won&apos;t be readable, is clearly not relevant in this case...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94608</commentid>
    <comment_count>11</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-10-11 23:17:25 +0000</bug_when>
    <thetext>Yeah, if we limit this to the case where there&apos;s no alt=&quot;&quot; in the first place, then I guess it&apos;s not so bad...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96262</commentid>
    <comment_count>12</comment_count>
    <who name="">contributor</who>
    <bug_when>2013-11-13 22:36:29 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r8280.
Check-in comment: Reframe the &lt;img&gt; rendering section for clarity
http://html5.org/tools/web-apps-tracker?from=8279&amp;to=8280</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96263</commentid>
    <comment_count>13</comment_count>
    <who name="">contributor</who>
    <bug_when>2013-11-13 22:42:27 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r8281.
Check-in comment: Adjust the rules on rendering images without &apos;alt&apos; attributes.
http://html5.org/tools/web-apps-tracker?from=8280&amp;to=8281</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>