files/en-us/web/api/performanceelementtiming/index.md
{{APIRef("Performance API")}}{{SeeCompatTable}}
The PerformanceElementTiming interface contains render timing information for image and text node elements the developer annotated with an elementtiming attribute for observation.
The aim of the Element Timing API is to give web developers or analytics tools the ability to measure rendering timestamps of critical elements on a page.
The API supports timing information on the following elements:
The author flags an element for observation by adding the elementtiming attribute on the element.
PerformanceElementTiming inherits from {{domxref("PerformanceEntry")}}.
{{InheritanceDiagram}}
This interface extends the following {{domxref("PerformanceEntry")}} properties for event timing performance entry types by qualifying them as follows:
0 as duration does not apply to this interface."element"."image-paint" for images and "text-paint" for text.0, otherwise the value of this entry's {{domxref("PerformanceElementTiming.loadTime", "loadTime")}}.This interface also supports the following properties:
id of the element.elementtiming attribute on the element.PerformanceElementTiming object.In this example two elements are being observed by adding the elementtiming attribute. A {{domxref("PerformanceObserver")}} is registered to get all performance entries of type "element" and the buffered flag is used to access data from before observer creation.
<p elementtiming="text" id="text-id">text here</p>
const observer = new PerformanceObserver((list) => {
list.getEntries().forEach((entry) => {
console.log(entry);
});
});
observer.observe({ type: "element", buffered: true });
Two entries will be output to the console. The first containing details of the image, the second with details of the text node.
{{Specifications}}
{{Compat}}
elementtiming HTML attribute