Hi List,
I have a new question about DOM Mutation Observer API in firefox [1].
Using this code in add-on SDK throws the following error. Others seems
to have similar problems [2].
/* Error:
Timestamp: 06/10/2013 10:55:24 PM
Error: twitter_autorefresh: An exception occurred.
TypeError: Value not an object.
resource://jid1-3p6zub9u2yiojg-at-jetpack/twitter_autorefresh/data/refresh.js
23
Traceback (most recent call last):
File
"resource://jid1-3p6zub9u2yiojg-at-jetpack/twitter_autorefresh/data/refresh.js",
line 23, in
observer.observe(target, config);
*/
// select the target node
var target = document.querySelector('.new-tweets-bar');
// create an observer instance
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
console.log(mutation.type);
});
});
// configuration of the observer:
var config = { attributes: true, childList: true, characterData: true }
// pass in the target node, as well as the observer options
observer.observe(target, config);
// later, you can stop observing
observer.disconnect();
Cheers
--arky
[1]
https://hacks.mozilla.org/2012/05/dom-mutationobserver-reacting-to-dom-changes-without-killing-browser-performance/
[2]
http://stackoverflow.com/questions/16581967/jquery-detect-element-injection