class MyElement extends HTMLElement {
set checked(flag) {
if (flag) {
this._internals.states.add("--checked");
} else {
this._internals.states.delete("--checked");
}
console.log(this._internals.states.has("--checked"));
}
}ElementInternals: states property / notebook
ElementInternals: states property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.