我在最新版本的 Chrome 中使用 Object.observe,想知道为什么它不适用于文本输入的“值”属性。下面的代码将记录添加/更改“foo”属性的更改,但不记录更改 value 属性的更改。有人知道为什么吗?
var myTextInput = document.getElementById('myTextInput');
Object.observe(myTextInput, function(changes){
changes.forEach(function(change) {
console.log(change);
});
});
myTextInput.value = 'test123';
myTextInput.foo = 'bar';