2 ms·
I think you missed a couple of bits in the article: > the above only works because Element has an id getter & setter that 'reflects' the id attribute … It didn
by jaffathecake 2y ago
I think you missed a couple of bits in the article:
> the above only works because Element has an id getter & setter that 'reflects' the id attribute … It didn't work in the example at the start of the article, because foo isn't a spec-defined attribute, so there isn't a spec-defined foo property that reflects it.
This is where the distinction is made between merely setting a property on a JavaScript object, and cases where you're actually calling an HTML-spec'd getter that has side effects.
The whole "reflection" section of the article is dedicated to how these HTML-spec'd getters and setters change the behaviour from the basic JavaScript property operations shown at the start of the article, and how it differs from property to property.
"LOL", I suppose.