[whatwg] Default value of "complete" attribute on new Image objects

Philip Taylor excors+whatwg at gmail.com
Tue Aug 10 17:47:13 PDT 2010


On Wed, Aug 11, 2010 at 1:06 AM, Jonas Sicking <jonas at sicking.cc> wrote:
> On Tue, Aug 10, 2010 at 4:56 PM, Philip Taylor <excors+whatwg at gmail.com> wrote:
>> On Wed, Aug 11, 2010 at 12:23 AM, Ian Hickson <ian at hixie.ch> wrote:
>>> I've updated the spec to have complete return true if the src is the empty
>>> string.
>>
>> Some canvas methods (drawImage, createPattern) are defined in terms of
>> the complete attribute ("If the image argument is an HTMLImageElement
>> object whose complete attribute is false, [...] then the
>> implementation must return without drawing anything."). Now that it
>> can be true when the image doesn't have any image data, what should
>> they do when passed such an image?
>
> Isn't the image fully loaded, just empty?

Depends how you define the concept of "fully loaded", I guess. The
spec says an empty src is invalid and triggers an error event and
makes the image "not available" (but now also "complete"), so it's not
entirely the same as a normal non-empty image.

> Seems like drawing such an
> image should act "normal". It just so happens that "normal" for an
> empty image would be to draw nothing?
>
> Just have to avoid divide-by-zero errors when creating patterns :)

Probably should do the same as a 0-pixel canvas ("If the image
argument is an HTMLCanvasElement object with either a horizontal
dimension or a vertical dimension equal to zero, then the
implementation must raise an INVALID_STATE_ERR exception."). (The spec
currently assumes complete HTMLImageElements always have non-zero
size, so the dimension check isn't applied to them.)

-- 
Philip Taylor
excors at gmail.com



More information about the whatwg mailing list