I was playing with Object.observe in the latest version of Chrome and was wondering why it does not work for the 'value' property of a text input. The code below will log a change for adding/changing the 'foo' property, but not for changing the value property. Anybody know why?
var myTextInput = document.getElementById('myTextInput');
Object.observe(myTextInput, function(changes){
changes.forEach(function(change) {
console.log(change);
});
});
myTextInput.value = 'test123';
myTextInput.foo = 'bar';
I'm not sure why this is, but since you're observing a DOM element's attributes, the mutation observer api may be more appropriate.