Opened 2 years ago

Closed 2 years ago

#5249 closed change (fixed)

Implement :-abp-contains() pseudo class for element hiding emulation

Reported by: hfiguiere Assignee: hfiguiere
Priority: Unknown Milestone:
Module: Core Keywords:
Cc: fhd, trev, mapx, greiner Blocked By: #3143
Blocking: Platform: Unknown / Cross platform
Ready: no Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29448560

Description (last modified by trev)

Background

After issue #3143 where we implement an equivalent of the :has() pseudo-class, we should implement an equivalent of the :contains() pseudo-class as well. While this one isn't part of the CSS4 standard (merely being referenced as a feature implemented by the JSONSelect library), this functionality sees to be useful to filter list authors and other ad blockers have a comparable feature already.

What to change

On top of the patch for issue #3143, add support for :-abp-contains() pseudo-class looking for substring matches within the text content of a node.

Change History (9)

comment:1 Changed 2 years ago by hfiguiere

  • Cc fhd trev added

comment:2 Changed 2 years ago by mapx

  • Cc mapx added

comment:3 Changed 2 years ago by mapx

Why :abp-has and :abp-has-text and not simply :has , :has-text like in the reference link about "Procedural cosmetic filters" ?

comment:4 Changed 2 years ago by trev

  • Description modified (diff)

Custom CSS additions are supposed to have a vendor prefix. At some point, browsers will implement :has() natively and it would be naive to assume that their implementation will be compatible to the one we created. Similarly, :contains() might be added to the CSS specification at some point but it is very unlikely that the CSS working group will specify the same behavior as what we plan to implement now. And - no, it's unlikely that our implementation will be fully compatible to uBlock's, with all the shortcuts that they tend to take.

comment:5 Changed 2 years ago by trev

  • Summary changed from Implement :has-text() pseudo class to Implement :-abp-contains() pseudo class for element hiding emulation

comment:6 Changed 2 years ago by hfiguiere

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:7 Changed 2 years ago by greiner

  • Cc greiner added

comment:8 Changed 2 years ago by abpbot

A commit referencing this issue has landed:
Issue 5249 - Implement :-abp-contains()

comment:9 Changed 2 years ago by hfiguiere

  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.