This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
Once we have internal slots, and define things in such a way that e.g. innerHTML does not use them, could we perhaps base whether Object.observe() works for a given IDL attribute on whether or not it declares an internal slot? That would be rather nice.
+1
Still sounds like a possible performance nightmare, at least given the current implementations. "slot" in this case is quite faraway from JS engine internal slots, so whenever the internal state, which implementations calculate often lazily when the someone calls the JS getter to access the state, changes, implementation would need to check if there are observers, and then synchronously inform JS engine about the state. And why would innerHTML behave differently to some other attributes?
innerHTML does not need an internal slot as it can be computed based on the tree (innerHTML doesn't represent a primitive). Therefore Object.observe() would not work for it.
That still doesn't explain why innerHTML wouldn't be observable. Why would certain attributes behave differently? Does a js author need to look at the specs all the time to see whether the attribute he/she is going to use can be observed. It is like MutationObserver could observe changes to only certain attributes but not to some others.
We could think about it. The requirement to _actually_ have an internal slot (to have the old value available) as opposed to conceptually having an internal slot as a specification device should not be made lightly, because it can affect the ability of engines to space-optimize.
Object.observe is dead.