[whatwg] Base URL’s effect on an empty @src element

Darin Adler darin at apple.com
Wed May 1 09:36:48 PDT 2013


On May 1, 2013, at 9:23 AM, Leif Halvard Silli <xn--mlform-iua at xn--mlform-iua.no> wrote:

> Given a document, where 
> 
> 1. the content of img @src is empty, and thus invalid, 
> 2. but there is base url which points to an image
> 
> Example:
>  <!DOCUMENT html>
>  <base href="image.jpg"/>
>  <img src="" alt="Text." />
> 
>  Live DOM Viewer test:
>  http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2236
> 
> Current UA behaviors:
> x) Firefox is the only one to render it the image 'image.jpg'.
> y) Webkit/Blink, IE10 and Opera12 render it as the alt text.
> 
> Questions:
> A) Which of x) and y) is correct?

(y) is correct.

> B) If the correct behavior is already defined in a spec, where is it defined?

<http://www.whatwg.org/specs/web-apps/current-work/multipage/embedded-content-1.html#update-the-image-data> and <http://www.w3.org/html/wg/drafts/html/master/embedded-content-0.html#update-the-image-data>.

The relevant part is, “if the element has a src attribute specified and its value is not the empty string, let selected source be the value of the element's src attribute”, which comes before the part that says to resolve the selected source relative to the element.

On May 1, 2013, at 9:26 AM, Boris Zbarsky <bzbarsky at mit.edu> wrote:

> On 5/1/13 12:23 PM, Leif Halvard Silli wrote:
>>  x) Firefox is the only one to render it the image 'image.jpg'.
> 
> This is what the whatwg/HTML5 spec called for last I checked, before the srcset stuff got added.

No, I believe this was already like this before srcset was added; you can see that in the w3.org draft which does not have srcset.

-- Darin


More information about the whatwg mailing list