Adblockplus uses mutation events in Chrome, even though mutation observers have been supported for the last few versions. Mutation observers are more reliable and have better performance than mutation events, and this will definitely speed up ABP for Chrome if the swap is made.
Firefox 14 also supports mutation observers.
[Fixed] In Chrome, mutation observers are not used
Re: In Chrome, mutation observers are not used
I was confused at first. Had to search the source code to realize that we still have that bogus "disable text ads" feature around and it still uses mutation events. I wonder whether anybody notices if I kill it...
Anyway, fixed: https://hg.adblockplus.org/adblockplusc ... a569d71eb2
Anyway, fixed: https://hg.adblockplus.org/adblockplusc ... a569d71eb2
Re: [Fixed] In Chrome, mutation observers are not used
You've forgotten the call to .observe, so that'll actually do nothing:
- set it to what you need, obviously.
Code: Select all
.observe(document.body, {subtree: true, childList: true, characterData: true, attributes: false});
Re: [Fixed] In Chrome, mutation observers are not used
Sorry, can't edit as I'm not registered.
Maybe you should disable that feature by default, since it will still have a performance impact with observers?
About that, if you can find an alternative to that you probably should - querySelectorAll doesn't return a live node list, so it's actually quite slow - http://www.nczonline.net/blog/2010/09/2 ... lectorall/. Obviously some testing with jsperf to check before implementing would be a good idea too.
Maybe you should disable that feature by default, since it will still have a performance impact with observers?
Code: Select all
var elts = document.querySelectorAll("a.IL_LINK_STYLE, a.lw_cad_link, a.cm_word, a.contextual, a.kLink, a[itxtdid], nobr, ispan, span.IL_AD");
Re: [Fixed] In Chrome, mutation observers are not used
Ouch. I actually tested that code and it worked - but maybe I didn't reload the extension. Fixed: https://hg.adblockplus.org/adblockplusc ... 7f33aa6e7bnallar wrote:You've forgotten the call to .observe, so that'll actually do nothing
Good idea, done: https://hg.adblockplus.org/adblockplusc ... 738088ac06nallar wrote:Maybe you should disable that feature by default, since it will still have a performance impact with observers?
As I said, that's a feature that I would prefer to remove rather than spend time improving it.