W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2013

MutationObserver does not observe state changes

From: Bradley Meck <bradley.meck@gmail.com>
Date: Sun, 28 Jul 2013 09:29:30 -0500
Message-Id: <E9B74265-A0F0-4518-82EF-612A5E3395A5@gmail.com>
To: www-dom@w3.org
Both MutationObservers *and* Object.observe are unable to listen for changes to state on <input> elements and the like. This seems like a pretty fundamental thing, to have one of these work (if not both). I expect most people to encounter some surprise when setting the state of an element but not observing them. I have come up with some questions due to this.

1. What is the official reason this is not supported?
2. Will there be a change due to this seemingly being a common expectation?
3. How should custom elements that have state be treated?
3. 1. Should stateful elements have to write to attributes to be observed?
3. 2. Should stateful elements write to host objects directly to be observed?

I have heard the following reasons (for checkboxes) that do not fully cover these points:

..checked etc. is a JS getter on the element. ( https://code.google.com/p/chromium/issues/detail?id=260881&can=1&q=mutationobservers&colspec=ID%20Pri%20M%20Iteration%20ReleaseBlock%20Cr%20Status%20Owner%20Summary%20OS%20Modified )
..checked does not map to an attribute ( https://bugzilla.mozilla.org/show_bug.cgi?id=898428  )
MutationObservers are not to observe state, only DOM ( irc.freenode.net#w3c )

Received on Sunday, 28 July 2013 20:06:55 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:37:03 UTC