The slotchange event is fired on a <slot> element when the node(s) it contained change. One can listen to that event via the EventTarget.addEventListener() API. The goal is now to expose the onslotchange IDL attribute from the GlobalEventHandlers and ShadowRoot interfaces, so that one can register a listener by attaching this attribute to target elements.

Motivation

The slotchange event is fired on a <slot> element when the node(s) it contained change. One can naturally listen to that event via the EventTarget.addEventListener() API. However, web developers are also familiar with the alternative attribute-based form (e.g. element.addEventListener("load", ...) Vs on <element onload="...">) which is sometimes convenient for quick testing. For consistency with other events, an attribute onslotchange is thus added.

Documentation

Specification

Specification link


Final published standard: Recommendation, Living Standard, Candidate Recommendation, or similar final form

Status in Chromium

Blink>DOM


No active development (tracking bug)

Consensus & Standardization

After a feature ships in Chrome, the values listed here are not guaranteed to be up to date.

Owners

Last updated on 2021-08-26