vuejs / vue

This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core
http://v2.vuejs.org
MIT License
207.7k stars 33.67k forks source link

Mutation "checked" not fireing when observing an Element with "v-bind:checked" #11596

Closed Perfect-Chaos closed 4 years ago

Perfect-Chaos commented 4 years ago

Version

2.6.11

Reproduction link

https://jsfiddle.net/dc57vkfm/

Steps to reproduce

Connect a MutationObserer to a Vue-Component with "v-bind:checked" and "v-bind:disabled". Then let both states (checked & disabled) change...

What is expected?

Both changes fire an according mutation.

What is actually happening?

Only the change in "disabled" fires a mutation. The change in "checked" is unnoticed.


Noticed this strange behaviour while migrating an old AngularJS1 application to vue.js.

I changed "ng-checked" to "v-bind:checked" and "ng-disabled" to "v-bind:disabled" and all seemed to work well but the existing MutationObserver now only detects the changes of the "disabled" attribute. In AngularJS1 both mutations were fired.

posva commented 4 years ago

This is unrelated to Vue as changing the input's checked property manually doesn't trigger the mutation observer either. In Vue, you wouldn't use a Mutation Observer anyway, you would use a watch to do side effects.


Remember to use the forum or the Discord chat to ask questions!