-
Notifications
You must be signed in to change notification settings - Fork 22.5k
/
index.md
53 lines (36 loc) · 1.39 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
---
title: "Element: elementTiming property"
short-title: elementTiming
slug: Web/API/Element/elementTiming
page-type: web-api-instance-property
status:
- experimental
browser-compat: api.Element.elementTiming
---
{{APIRef("DOM")}}{{SeeCompatTable}}
The **`elementTiming`** property of the {{domxref("Element")}} interface identifies elements for observation in the {{domxref("PerformanceElementTiming")}} API. The `elementTiming` property reflects the value of the [`elementtiming`](/en-US/docs/Web/HTML/Attributes/elementtiming) attribute.
## Value
A string.
## Examples
### Logging the value of `elementTiming`
In this example, adding the [`elementtiming`](/en-US/docs/Web/HTML/Attributes/elementtiming) attribute to the {{HTMLElement("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 {{domxref("PerformanceElementTiming")}}.
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- {{domxref("PerformanceElementTiming")}}
- [`elementtiming`](/en-US/docs/Web/HTML/Attributes/elementtiming) HTML attribute