Element: elementTiming property

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Thuộc tính elementTiming của giao diện Element identifies elements for observation in the PerformanceElementTiming API. The elementTiming property reflects the value of the elementtiming attribute.

Giá trị

Một chuỗi.

Ví dụ

Logging the value of elementTiming

Trong ví dụ này, adding the elementtiming attribute to the <img> element sets the image to be observed.

html
<img
  src="image.jpg"
  alt="a nice image"
  elementtiming="big-image"
  id="myImage" />

You can get the string value of the elementtiming HTML attribute by calling el.elementTiming.

js
const el = document.getElementById("myImage");
console.log(el.elementTiming); // "big-image"

For a more complete example on how to use the Element Timing API, see PerformanceElementTiming.

Đặc tả kỹ thuật

Specification
Element Timing API
# dom-element-elementtiming

Trình duyệt hỗ trợ

Xem thêm