natevw
natevw

Reputation: 17942

Where is the HTMLImageElement 'load' event specified?

For example, the HTML specification for an input element of type=image includes the following regarding handling of that element's src field:

if the download was successful and the image is available, queue an element task on the user interaction task source given the input element to fire an event named load at the input element

But in the HTML specification regarding the img element I do not find any match to the string "fire an event" (although I do see an example which assigns a callback to img.onload!)

I am looking for details about when exactly this event is fired and details of e.g. whether it bubbles or not.

Upvotes: 4

Views: 1016

Answers (1)

natevw
natevw

Reputation: 17942

The version of the HTML spec I was referencing simply splits up a lot of the details re. image loading into the next section, which is on a separate page in the "multipage" version.

The details can be found in § 4.8.4.3.5 — "Updating the image data" which has a whole lot of detailed steps and pathways that may need to be taken. Several of them do indeed culminate in a step like:

Fire an event named load at the img element.

The "fire an event" algorithm in turn has steps to be taken. Since no additional details are specified in the img steps that reference the fire steps, the fired event would be initialized with the defaults for bubbles/cancelable /composed all false.

Upvotes: 2

Related Questions