[whatwg] <img> element comments
Anne van Kesteren
fora at annevankesteren.nl
Sat Nov 4 02:04:08 PST 2006
On Sat, 04 Nov 2006 07:37:32 +0100, Ian Hickson <ian at hixie.ch> wrote:
>> * 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?
From what I recall setting the DOM attribute on a newly created element
(not appending it to the DOM) would cause download immediately in all
browsers, but some browsers acted differently when the "src" content
attribute was set on the newly created element. As in, the download
started the moment it was appended to the DOM, not before (no load event
At least the section is clearer now in terms of events. That's nice!
>> * 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?
If you require this only for images with known intrinsic dimensions than
that would be fine with me (as in, for some cases of SVG the requirements
are likely different).
(To clarify, where I said "as defined" in my original message I meant "as
currently defined". There could certainly be a use case for them just as
there's a use case for them with the <canvas> element.)
>> * 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?
Is the buggyness in fallback or just because <object> does a lot?
Anne van Kesteren
More information about the whatwg