xpath adblock

Various discussions related to Adblock Plus development
Post Reply
User avatar
Gingerbread Man
Posts: 1339
Joined: Fri Aug 12, 2011 5:28 am

Re: xpath adblock

Post by Gingerbread Man »

I split off this post into its own thread, because it's an interesting request if feasible, and it didn't have much to do with its parent thread.
User avatar
greiner
ABP Developer
Posts: 899
Joined: Mon Sep 03, 2012 5:29 pm
Location: Cologne, Germany

Re: xpath adblock

Post by greiner »

We're using CSS selectors because we're directly applying them to the page without any modifications and let the browser do all the hard work for us. However, we can't do that with XPath without negatively impacting element hiding performance.
User avatar
Gingerbread Man
Posts: 1339
Joined: Fri Aug 12, 2011 5:28 am

Re: xpath adblock

Post by Gingerbread Man »

greiner wrote:However, we can't do that with XPath without negatively impacting element hiding performance.
In the same way that regexp filters are slower than regular filters but
  1. Sometimes there's no other way to block the item.
  2. One or two slow filters won't have any noticeable impact on performance.
lewisje
Posts: 2743
Joined: Mon Jun 14, 2010 12:07 pm

Re: xpath adblock

Post by lewisje »

It looks like uBlock Origin has implemented both the :has() relational pseudo-class (formerly known as the parent-selector, new syntax inspired by jQuery) and XPath-based hiding rules: https://github.com/gorhill/uBlock/issue ... -230120248

It looks like this is the most relevant part of the code: https://github.com/gorhill/uBlock/blob/ ... ng.js#L748

Ideally, if :has() is ever widely implemented (right now no browsers implement it), the extension will be able to use this implementation as only a fallback.
There's a buzzin' in my brain I really can't explain; I think about it before they make me go to bed.
mikhoul
Posts: 17
Joined: Thu Jan 24, 2013 5:54 pm

Re: xpath adblock

Post by mikhoul »

lewisje wrote:It looks like uBlock Origin has implemented both the :has() relational pseudo-class (formerly known as the parent-selector, new syntax inspired by jQuery) and XPath-based hiding rules: https://github.com/gorhill/uBlock/issue ... -230120248

I needed to do a filter with has() and asked to myself if ABP was having something like that...

I ask to myself if I keep ABP and use UserScripts for more complicated filters or if I switch to uBlock origin.

The only thing I would really miss is the convenience of the list of blockable items.

Debating with myself what I should do :roll:
lewisje
Posts: 2743
Joined: Mon Jun 14, 2010 12:07 pm

Re: xpath adblock

Post by lewisje »

uBlock Origin has a logger that is quite useful, but anyway, both :has() and xpath are being considered for ABP too: https://issues.adblockplus.org/ticket/2360
There's a buzzin' in my brain I really can't explain; I think about it before they make me go to bed.
Post Reply