From 0f8a2bc26c78bd6220b94723b362e24806042069 Mon Sep 17 00:00:00 2001 From: SeverAnna Date: Thu, 11 Jun 2026 08:39:01 +0300 Subject: [PATCH 1/2] Add :contains() and clean up attributes Introduce the recommended :contains() pseudo-class with examples Consolidate the deprecation notice for legacy special attributes into a single paragraph and remove the repeated caution blocks --- .../ad-filtering/create-own-filters.md | 37 ++++++++----------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/docs/general/ad-filtering/create-own-filters.md b/docs/general/ad-filtering/create-own-filters.md index 1ead84171ab..23b9136d590 100644 --- a/docs/general/ad-filtering/create-own-filters.md +++ b/docs/general/ad-filtering/create-own-filters.md @@ -4399,16 +4399,29 @@ This rule removes all `div` elements with the attribute `some_attribute` on `exa ### Special attributes {#html-filtering-rules--special-attributes} -In addition to usual attributes, which value is every element checked for, there is a set of special attributes that change the way a rule works. Below there is a list of these attributes: +In addition to checking standard HTML attributes, you can filter elements based on their inner text or script content. -#### `tag-content` +### `:contains()` + +The recommended way to filter elements by their content is using the `:contains()` pseudo-class. It allows you to target elements based on the actual text or script variables they contain, supporting both plain text strings and regular expressions. + +**Examples:** + +```example.com$$script:contains(Adverts) +example.com$$div:contains("Sponsored by") +example.com$$script:contains(/ad_system_\d+/) +``` + +The first rule removes any `