Re: [whatwg/dom] MutationObserver with querySelector for elements (#77)

zbraniecki, I thing I meet the same problem like yours.
In some case, you could use `mutation.target` to instead of 'querySelector' to decrease the calling numbers of mutation.
Here is my code
``` javascript
new MutationObserver(
    function (mutations)
    {
      mutations.map(
        function (mutation)
        {
          if (mutation.target != '[object HTMLBodyElement]' &&
              mutation.target != '[object HTMLScriptElement]' &&
              (mutation.removedNodes.length != 0 ||
              mutation.addedNodes.length != 0)) {
            Languages.update(); //Here is what you want to do
          }
        }
      );
    }
  ).observe(
    document.querySelector('body'),
    {attributes: false, childList: true, characterData: false, subtree:true}
  );
```

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/77#issuecomment-234693755

Received on Saturday, 23 July 2016 02:22:02 UTC