I am in Chrome 19 and I created a new mutation observer object:

var observer = new WebKitMutationObserver(function(mutations, observer) {
  console.log(mutations, observer);
});

And then I observe:

observer.observe(document, {
  subtree: true,
  childList: true,
  characterData: true,
  attribute: true      
});

It seems that this setup only gets triggered when i insert or remove a node, or change the text of a node. It does not get triggered if I change an attribute or an inline css style of an element. Why is this?

有帮助吗?

解决方案

According to the spec draft, the property you want to set is attributes: true, not attribute: true.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top