Closed
Bug 757077
Opened 13 years ago
Closed 13 years ago
Mutation Observer callback not triggered when select box attribute's change
Categories
(Firefox :: Untriaged, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: hello, Unassigned)
References
()
Details
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.46 Safari/536.5
Steps to reproduce:
1. Create Mutation Observer and observe `select` DOM element
2. Change selected option in any way, other than `setAttribute` (which is the only way that doesnt update select box's UI)
An example: http://jsfiddle.net/gryzzly/wqHn5/
StackOverflow question: http://stackoverflow.com/q/10411824/
Actual results:
Observer doesn't react to the changes on select box at all.
Expected results:
An observer should trigger the callback function with `mutations` argument.
Reporter | ||
Comment 1•13 years ago
|
||
Both Chrome 19 and Chrome Canary (21) behave the same way, here's the bug filled for Chromium: https://code.google.com/p/chromium/issues/detail?id=128991
Comment 2•13 years ago
|
||
This is the expected behaviour for MutationObservers, and the thing to remember is that when a select box's selection changes, the DOM nodes involved aren't changed at all. A slightly different use case that would work would be if option elements were added to or removed from the select element.
The Chrome bug was closed for similar reasons:
https://code.google.com/p/chromium/issues/detail?id=128991#c4
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
Reporter | ||
Comment 3•13 years ago
|
||
I'd like to re-appeal, if I do:
select.value = "foo";
And it updates the UI of the select box (and it doesn't fire `change` event, by the way), the Mutation Observer should trigger the callback. If the spec says otherwise, then I'd say that the spec is not describing expected behavior here.
I will give you an example: you are implementing a script that will run on third party website. That script needs to monitor changes to select box. However, the select box is hidden and the JavaScript is used to provide select box functionality, and that JavaScript does "select.value = 'something'". I do not get neither `change` event, neither do I get Mutation Observer's callback. However, submitting the form will have the right value, as well as the UI would be updated (as in my case).
Thanks!
You need to log in
before you can comment on or make changes to this bug.
Description
•