Performance of :-abp-has()

Various discussions related to filter list maintenance

Moderator: njones

Post Reply
humppa
Posts: 5
Joined: Sun Feb 14, 2016 12:53 pm

Performance of :-abp-has()

Post by humppa »

Just for my comprehension:
Here it says
Also it is recommended that the selector inside a :-abp-has() starts with a combinator like >, + or ~. Otherwise a lot of elements will be needlessly selected as more that one ancestor will match.
So it is better to use

Code: Select all

site.com##.wrapper-safe:-abp-has(>.fb > div[class^="fb-col-"] > section > a.DealOfTheDay)
or

Code: Select all

site.com##.wrapper-safe:-abp-has(>div > div > section > .DealOfTheDay)
than this

Code: Select all

site.com##.wrapper-safe:-abp-has(.DealOfTheDay)
?
lewisje
Posts: 2743
Joined: Mon Jun 14, 2010 12:07 pm

Re: Performance of :-abp-has()

Post by lewisje »

yes, because it starts by looking for just direct descendants, not all descendants
There's a buzzin' in my brain I really can't explain; I think about it before they make me go to bed.
humppa
Posts: 5
Joined: Sun Feb 14, 2016 12:53 pm

Re: Performance of :-abp-has()

Post by humppa »

Ok thanks, I just thought the many filters (costly: [attribute*="value"]) inside the braces could outweigh the benefits of starting with >.
Of course I understand it's always a matter of given site structure, too.
sbell
ABP Technical Support Specialist
Posts: 522
Joined: Wed Jul 05, 2017 8:08 pm

Re: Performance of :-abp-has()

Post by sbell »

I'm sorry, but we do not want to cover site-specific filter questions in the Adblock Plus forum.

The Adblock Plus project is deliberately not involved in authoring filters. The best place to get help for such questions is the forum of a filter list project such as EasyList.
User avatar
mapx
Posts: 21940
Joined: Thu Jan 06, 2011 2:01 pm

Re: Performance of :-abp-has()

Post by mapx »

@sbell, it's about how to use certain features ABP is providing.

-abp-has is a new feature and the users are asking how to use it better.
humppa
Posts: 5
Joined: Sun Feb 14, 2016 12:53 pm

Re: Performance of :-abp-has()

Post by humppa »

Thank you mapx, that's what I would have written if the topic wasn't locked.
Maybe sbell thought, site.com is a real site.
However, I think I got my answer and a new best practice for -abp-has:()

Thanks, keep up the good work :-)
sbell
ABP Technical Support Specialist
Posts: 522
Joined: Wed Jul 05, 2017 8:08 pm

Re: Performance of :-abp-has()

Post by sbell »

My apologies! The post was indeed redacted in error.
humppa
Posts: 5
Joined: Sun Feb 14, 2016 12:53 pm

Re: Performance of :-abp-has()

Post by humppa »

@sbell
It's ok, that happens. We're all just people. Nice of you that you replied again!
Post Reply