Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion docs/general/ad-filtering/create-own-filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -4261,6 +4261,8 @@ The syntax with an optional `value` in the attributes is supported by AdGuard fo

### Syntax

Syntax supported by AdGuard for Windows, AdGuard for Mac, AdGuard for Android, AdGuard for Linux with CoreLibs, and AdGuard Browser Extension prior to v5.2:

```text
selector = [tagName] [attributes] [pseudoClasses]
combinator = ">"
Expand All @@ -4278,6 +4280,25 @@ pseudoClasses = pseudoClass *pseudoClass
- **`pseudoArgs`** — the arguments of a function-style pseudo-class.
- **`combinator`** — an operator that works similarly to the [CSS child combinator](https://developer.mozilla.org/en-US/docs/Web/CSS/Child_combinator): that is, the `selector` on the right of the `combinator` will only match an element whose direct parent matches the `selector` on the left of the `combinator`.

Syntax supported by AdGuard Browser Extension v5.3 or later:

```text
rule = [domains] "$$" selector
domains = [domain0, domain1[, ...[, domainN]]]
```

- **`selector`** — [CSS selector](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_Started/Selectors), defines the element(s) to be removed from the HTML code before the page is loaded.
- **`domains`** — domain restriction for the rule. Same principles as in [element hiding rule syntax](#cosmetic-elemhide-rules).

:::caution Limitations

In AdGuard Browser Extension v5.3 or later following limitations apply:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In AdGuard Browser Extension v5.3 or later, the following limitations apply:
or
The following limitations apply to AdGuard Browser Extension v5.3 and later:

@kurrx kurrx Dec 22, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made like this, is this okay? (removed one bullet and changed wording about limitation)

The following limitations apply to AdGuard Browser Extension v5.3 and later:

- Pseudo-elements (e.g., `::before`, `::after`) are not supported, as they are not applicable in the context of HTML filtering.


- Universal selector (`*`) is not supported, as such rules require checking every element in the DOM tree, which may lead to significant performance issues. More targeted selectors should be used instead.
- Pseudo-elements (e.g., `::before`, `::after`) are not supported, as they are not applicable in the context of HTML filtering.

:::

### Examples

**HTML code:**
Expand Down Expand Up @@ -4343,6 +4364,8 @@ $$script[tag-content="banner"]

The `tag-content` special attribute must not appear in a selector to the left of a `>` combinator.

This limitation does not apply to AdGuard Browser Extension v5.3 or later.

:::

#### `wildcard`
Expand All @@ -4367,6 +4390,8 @@ It checks if the element code contains the two consecutive substrings `banner` a

The `wildcard` special attribute must not appear in a selector to the left of a `>` combinator.

This limitation does not apply to AdGuard Browser Extension v5.3 or later.

:::

#### `max-length`
Expand Down Expand Up @@ -4395,6 +4420,8 @@ This rule will remove all the `div` elements, whose code contains the substring

The `max-length` special attribute must not appear in a selector to the left of a `>` combinator.

This limitation does not apply to AdGuard Browser Extension v5.3 or later.

:::

#### `min-length`
Expand All @@ -4419,6 +4446,8 @@ This rule will remove all the `div` elements, whose code contains the substring

The `min-length` special attribute must not appear in a selector to the left of a `>` combinator.

This limitation does not apply to AdGuard Browser Extension v5.3 or later.

:::

### Pseudo-classes {#html-filtering-rules--pseudo-classes}
Expand All @@ -4445,7 +4474,7 @@ or

:::info Compatibility

The `:contains()` pseudo-class is supported by AdGuard for Windows, AdGuard for Mac, AdGuard for Android, and AdGuard for Linux with [CoreLibs] v1.13 or later.
The `:contains()` pseudo-class is supported by AdGuard for Windows, AdGuard for Mac, AdGuard for Android, AdGuard for Linux with [CoreLibs] v1.13 or later, and AdGuard Browser Extension v5.3 or later.

:::

Expand All @@ -4455,6 +4484,8 @@ Requires that the inner HTML of the element contains the specified text or match

A `:contains()` pseudo-class must not appear in a selector to the left of a `>` combinator.

This limitation does not apply to AdGuard Browser Extension v5.3 or later.

:::

### Exceptions
Expand Down