coderef

ToggleEvent sourceBaseline · Newly available

The source property of a ToggleEvent object is the element which triggered the toggle event to fire for a popover, <dialog>, or <details> element, if applicable.

Works in the latest version of every major browser, but older devices may not support it yet. Baseline since May 11, 2026.

Browser support

DesktopChrome
1–139Not supported
140+Supportedsince Sep 2, 2025
Current: 155
Edge
12–139Not supported
140+Supportedsince Sep 5, 2025
Current: 154
Firefox
1–144Not supported
145+Supportedsince Nov 11, 2025
Current: 157
Safari
1–26.4Not supported
26.5+Supportedsince May 11, 2026
Current: 27
MobileChrome Android
18–139Not supported
140+Supportedsince Sep 2, 2025
Current: 155
Firefox Android
4–144Not supported
145+Supportedsince Nov 11, 2025
Current: 157
Safari iOS
1–26.4Not supported
26.5+Supportedsince May 11, 2026
Current: 27

How to use

Every current browser supports this, but it only became Baseline on May 11, 2026. Use it as a progressive enhancement, or keep a fallback if you support older devices.

Example

Full syntax and examples are on MDN: source.

Feature detection

JS · check before using
if ("ToggleEvent" in globalThis && "source" in ToggleEvent.prototype) {
  // ToggleEvent.source is available
}