JavaScript Element elementTiming Property

Beginner
⏱️ 11 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Experimental
Instance property

What You’ll Learn

Element.elementTiming is an instance property that reflects the elementtiming HTML attribute. Learn how that string labels an element for the Element Timing API, how to read and set it, and how to feature-detect—with five examples and try-it labs.

01

Kind

Instance property

02

Access

Get / set (reflects)

03

Type

String

04

Reflects

elementtiming

05

Used by

PerformanceElementTiming

06

Status

Experimental

Introduction

The Element Timing API helps you measure when important elements (hero images, key text blocks, and similar) become visible and painted. To opt an element in, you give it an identifier with the elementtiming attribute.

elementTiming is the JavaScript reflection of that attribute: the same string you wrote in HTML, available on the Element object.

JavaScript
const el = document.getElementById("myImage");
console.log(el.elementTiming); // "big-image"
💡
Beginner tip

Think of elementTiming as a label for performance tooling—not a timestamp by itself. The timing numbers come from PerformanceElementTiming entries later.

Understanding the Property

MDN: the elementTiming property of the Element interface identifies elements for observation in the PerformanceElementTiming API. The property reflects the value of the elementtiming attribute.

  • Reflects HTML — same value as the elementtiming attribute.
  • String identifier — choose a clear name like hero-image.
  • Opt-in — only marked elements are observed for element timing.
  • Experimental — Limited availability; Chromium-first today (MDN).

📝 Syntax

JavaScript
elementTiming

Value

A string: the element’s Element Timing identifier (empty when unset).

ItemDetail
Typestring
AccessGet / set (reflects attribute)
HTML attributeelementtiming
Related APIPerformanceElementTiming
⚠️
Feature-detect first

Check "elementTiming" in Element.prototype (or try/catch attribute usage) before relying on Element Timing in analytics code.

📋 MDN Image Example

MDN marks an image for observation with elementtiming="big-image", then reads the property:

JavaScript
<img
  src="image.jpg"
  alt="a nice image"
  elementtiming="big-image"
  id="myImage" />
JavaScript
const el = document.getElementById("myImage");
console.log(el.elementTiming); // "big-image"

Related learning: PerformanceElementTiming, PerformanceObserver, and customElementRegistry.

⚡ Quick Reference

GoalCode / note
Read identifierel.elementTiming
Set in JSel.elementTiming = "hero"
Set in HTMLelementtiming="hero"
Feature-detect"elementTiming" in Element.prototype
MDN statusExperimental · Limited availability

🔍 At a Glance

Four facts about Element.elementTiming.

Kind
get / set

Instance

Type
string

Identifier

Reflects
elementtiming

HTML attr

Status
experimental

Not Baseline

Examples Gallery

Examples follow MDN Element: elementTiming. Labs focus on reading and setting the identifier; collecting entries needs PerformanceObserver where supported.

📚 Getting Started

Read and set the Element Timing identifier string.

Example 1 — Read elementTiming

MDN shape: an image marked with elementtiming="big-image".

JavaScript
const el = document.getElementById("myImage");
console.log(el.elementTiming); // "big-image"
Try It Yourself

How It Works

The property returns the string from the elementtiming attribute. That label shows up on matching PerformanceElementTiming entries.

Example 2 — Set the Identifier in JavaScript

Assign a clear name so performance tools can find the element.

JavaScript
const el = document.getElementById("hero");
el.elementTiming = "hero-banner";
console.log(el.elementTiming);
console.log(el.getAttribute("elementtiming"));
Try It Yourself

How It Works

Because the property reflects the attribute, setting one updates the other in supporting browsers.

📈 Attribute Sync, Detection & Snapshot

Confirm attribute sync, then feature-detect safely.

Example 3 — Empty When Unmarked

Elements without elementtiming typically report an empty string.

JavaScript
const el = document.getElementById("plain");
console.log(JSON.stringify(el.elementTiming)); // ""
Try It Yourself

How It Works

No identifier means the element is not opted into Element Timing observation via this API.

Example 4 — Feature-Detect

Gate Element Timing usage on property support.

JavaScript
if ("elementTiming" in Element.prototype) {
  console.log("Element.elementTiming supported");
} else {
  console.log("not supported");
}
Try It Yourself

How It Works

Firefox and Safari typically report unsupported today. Keep analytics optional.

Example 5 — Support Snapshot

Feature-detect and remember the rules.

JavaScript
console.log({
  supported: "elementTiming" in Element.prototype,
  reflects: "elementtiming HTML attribute",
  tip: "Label only — timings come from PerformanceElementTiming",
  status: "Experimental · Limited availability (MDN)"
});
Try It Yourself

How It Works

Use elementTiming to opt elements in; use the Performance Timeline to read render/load metrics when the browser supports them.

🚀 Common Use Cases

  • Labeling hero images for Element Timing performance dashboards.
  • Marking above-the-fold text or media for Core UX render metrics.
  • Setting identifiers dynamically when content is injected by JavaScript.
  • Debugging which elements are opted into PerformanceElementTiming.
  • Teaching how HTML attributes reflect into Element IDL properties.

🔧 How It Works

1

You label the element

Via elementtiming or elementTiming.

Opt-in
2

The browser observes paint/load

Supporting engines track the marked element.

Observe
3

Performance entries are created

PerformanceElementTiming records include your identifier.

Measure
4

You read the string anytime

Use el.elementTiming to confirm the label.

📝 Notes

Limited / Experimental Support

Element.elementTiming is Experimental and not Baseline. It belongs to the Element Timing / PerformanceElementTiming API. Always feature-detect. Logos use the shared browser-image-sprite.png sprite from this project.

Experimental · Not Baseline

Element.elementTiming

String — reflects elementtiming; labels elements for PerformanceElementTiming.

Limited Experimental
Google Chrome 77+
Yes
Microsoft Edge 79+
Yes
Opera 64+ (Chromium)
Yes
Mozilla Firefox Not supported — feature-detect
No
Apple Safari Not supported — feature-detect
No
Internet Explorer Not supported
No
elementTiming Limited

Bottom line: Use elementTiming to opt elements into Element Timing. Collect metrics with PerformanceObserver where supported. Never require Element Timing for core UX — Chromium-first today.

Conclusion

elementTiming is a simple string label that opts an element into the Element Timing API. Reflect the elementtiming attribute, feature-detect carefully, and collect real timings through PerformanceElementTiming where the browser supports it.

Continue with firstElementChild, customElementRegistry, or the JavaScript hub.

💡 Best Practices

✅ Do

  • Use clear identifiers like hero-image
  • Feature-detect before analytics code
  • Mark only important UX elements
  • Pair with PerformanceObserver when supported
  • Keep Element Timing optional for core UX

❌ Don’t

  • Confuse the label string with a timestamp
  • Assume Firefox/Safari support today
  • Mark every element on the page
  • Skip feature detection in shared libraries
  • Require Element Timing for critical flows

Key Takeaways

Knowledge Unlocked

Five things to remember about elementTiming

String label reflecting elementtiming—opts into Element Timing.

5
Core concepts
📝 02

String

identifier

Type
🔍 03

Perf labels

hero & media

Use
04

Experimental

not Baseline

Status
🎯 05

Detect first

Chromium-first

Tip

❓ Frequently Asked Questions

It identifies an element for observation by the PerformanceElementTiming API. The property reflects the elementtiming HTML attribute as a string.
MDN marks Element.elementTiming as Experimental and Limited availability (not Baseline). It is not Deprecated or Non-standard. Always feature-detect before production use.
Add the elementtiming attribute in HTML (for example elementtiming="big-image") or set el.elementTiming = "big-image" in JavaScript where supported.
A string — the identifier you chose for that element. Empty string when the attribute is missing.
Primarily Chromium-based browsers (Chrome 77+, Edge 79+, Opera). Firefox and Safari generally do not support Element Timing yet.
Observe PerformanceEntry records of type "element" with PerformanceObserver, or read PerformanceElementTiming entries. See MDN PerformanceElementTiming for the full flow.
Did you know?

elementTiming is only the identifier. The actual paint/load timestamps live on PerformanceElementTiming entries—observe type "element" with a PerformanceObserver in supporting browsers.

Next: firstElementChild

Learn how to read the first child element, skipping text nodes.

firstElementChild →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful