[whatwg] <img> element comments

Ian Hickson ian at hixie.ch
Fri Nov 3 22:37:32 PST 2006

On Fri, 3 Nov 2006, Anne van Kesteren wrote:
> * I think the section on the <img> element should also define 'new 
> Image([width [, height]])' which effectively returns an HTMLImageElement 
> object in current browsers.


> * It should probably mention 'img.src = foo' (that loading directly 
> starts). I thought that 'img.setAttribute("src", foo)' even did 
> different things in browsers (when the element is not yet inserted into 
> the document) so reflect might not be accurate.

I couldn't find a difference. Any idea what it was?

> * I would also suggest to put "If the src attribute is omitted, there is 
> no alternative image representation." after the last statement on the 
> alt attribute.

Done. (I think. I edited a bunch of stuff before reading your comment so 
it may be not quite what you meant.)

> * Regarding the alt attribute, wouldn't it make sense to just allow it 
> to be omitted? In terms of meaning it seems the same. On the other hand, 
> it probably shows the difference between people who thought of the 
> alternative representation and people that haven't.

Maybe. I dunno.

> * I think it would also make sense to show some more examples for the 
> alt attribute. http://www.cs.tut.fi/~jkorpela/html/alt.html might be too 
> large to be included in the specification, but guidelines to that effect 
> would be more than welcome.


> * The height and width attributes as defined are completely 
> presentational. I don't really see any value in keeping them. Now I 
> suppose they have to be supported anyway, but so does <body bgcolor="">.

I'm thinking of only allowing integer values, and requiring them to be 
equal to the dimensions of the image, if present (and requiring both to 
be present if either is present). Would people be ok with that?

The use case is giving the UA information on the dimensions of the image 
before the image has been downloaded, the same as the type="" or 
hreflang="" attributes on the <link> element give information on the 
resource before the resource is fetched.

> * Perhaps we can allow content for XML documents?

That's tempting. We'd have to allow it for HTML too (via DOM 
manipulation). I'm not sure, though. <object> is pretty buggy, wouldn't 
this just cause <img> to get those bugs?

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list