HTML 属性:elementtiming

elementtiming 属性用于指示元素被标记为由使用 "element" 类型的 PerformanceObserver 对象跟踪。更多详情请参见 PerformanceElementTiming 接口。

¥The elementtiming attribute is used to indicate that an element is flagged for tracking by PerformanceObserver objects using the "element" type. For more details, see the PerformanceElementTiming interface.

该属性可以应用于 <svg> 内的 <img><image> 元素、<video> 元素的海报图片、具有 background-image 的元素以及包含文本节点的元素,例如 <p>

¥This attribute may be applied to <img>, <image> elements inside an <svg>, poster images of <video> elements, elements which have a background-image, and elements containing text nodes, such as a <p>.

在 DOM 中,该属性反映为 Element.elementTiming

¥In the DOM, this attribute is reflected as Element.elementTiming.

用法

¥Usage

elementtiming 给出的值成为观察到的元素的标识符。

¥The value given for elementtiming becomes an identifier for the observed element.

html
<img alt="alt" src="img.jpg" elementtiming="label for element" />

你可能想要观察的元素的良好竞争者是:

¥Good contenders for elements you might want to observe are:

  • 文章的主图片。
  • 博客文章标题
  • 购物网站轮播中的图片。
  • 页面上主视频的海报图片。

示例

¥Examples

html
<img alt="Alt for a main blog post image" src="my-massive-image.jpg" elementtiming="Main image">

<p elementtiming="important-text">Some very important information.</p">

也可以看看