javascript - HTMLImageElement 'load' 事件指定在哪里?

标签 javascript html image dom-events

例如,input element of type=image 的 HTML 规范包括以下关于处理该元素的 src 字段的内容:

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

但是在关于 img element 的 HTML 规范中我没有找到与字符串“fire an event”的任何匹配项(尽管我确实看到了一个将回调分配给 img.onload 的示例!)

我正在寻找有关此事件确切触发时间的详细信息以及详细信息,例如是否起泡

最佳答案

我引用的 HTML 规范版本简单地拆分了很多细节。图片加载到下一部分,在“多页”版本中位于单独的页面上。

详情请见§ 4.8.4.3.5 — "Updating the image data"其中包含许多可能需要采取的详细步骤和途径。其中有几个确实以如下步骤达到高潮:

Fire an event named load at the img element.

"fire an event"算法又需要采取步骤。由于在引用触发步骤的 img 步骤中未指定其他详细信息,因此触发的事件将为 initialized with the defaults。对于 bubbles/cancelable/composed 都是假的。

关于javascript - HTMLImageElement 'load' 事件指定在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67540454/

相关文章:

javascript - IE 在 JavaScript 中的 "self = this"上抛出异常?

javascript - 单击 famo.us ScrollView 内的项目

javascript - html2canvas 图层为空白

swift - 将多部分图像、视频和参数发送到服务器时出现问题

css - 如何访问 <a href 标签内的 <img 标签以在 IE 中将焦点设置为 <img

javascript - 如何让 JSLint 容忍前导分号?

javascript - SockJs Eventbus 桥 : Restarting Verticle forces me to restart ClientHtml?

javascript - 使用表单运行 javascript 方法

javascript - 将表列 append 到 td 标签内带有 span 标签的表

html - 如何在html中为单个div中的两个图像制作zoomIn动画