uBlockOrigin / uBlock-issues

This is the community-maintained issue tracker for uBlock Origin
https://github.com/gorhill/uBlock
937 stars 79 forks source link

Cosmetic class filters beginning with a number getting discarded #940

Closed yourduskquibbles closed 4 years ago

yourduskquibbles commented 4 years ago

Prerequisites

Description

Class filter beginning with a number get thrown out as invalid.

From logger:

Discarded Easylist filter: easylist

Test Filters added by me: testfilters

A specific URL where the issue occurs

Update Easylist or test in My Filters with test.com##.1-abp & test.com##.2-abp

Steps to Reproduce

1a. Update Easylist or 1b. Add test filters to My Filters test.com##.1-abp & test.com##.2-abp

  1. View invalid filter in logger

Expected behavior:

Class Filters beginning with a number are parsed and used.

Actual behavior:

Class filters beginning with a number get thrown out

Your environment

uBlock-user commented 4 years ago

https://github.com/orgs/uBlockOrigin/teams/ublock-issues-volunteers/discussions/167?from_comment=6#discussion-167-comment-6

gwarser commented 4 years ago

This is better: https://github.com/orgs/uBlockOrigin/teams/ublock-issues-volunteers/discussions/167?from_comment=5#discussion-167-comment-5

The problem is the selector .123tv-ads is not valid. That filter is from EasyList:

123tvnow.com##.123tv-ads

As per CSS character escape sequences:

If the first character of an identifier is numeric, you’ll need to escape it based on its Unicode code point. For example, the code point for the character 1 is U+0031, so you would escape it as \000031 or \31 .

Basically, to escape any numeric character, just prefix it with \3 and append a space character ( ). Yay Unicode!

So this would work:

123tvnow.com##.\31 23tv-ads

This needs to be fixed in EasyList.

gwarser commented 4 years ago

ABP "Picker" correctly escapes classes.

AdBlock for Chrome creates Attribute Selector.

Both require escaping to work.