Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardHTMLobservedAttributesSingle-choice MCQ

Static getter behavior: at what moment does the browser read a custom element's observedAttributes, and what is the consequence shown here?

class X extends HTMLElement { static get observedAttributes() { return this._list || ['a']; } attributeChangedCallback(n){ console.log('changed', n); } } X._list = ['a','b']; customElements.define('x-el', X); // later: element.setAttribute('b', '1');