To remove a CSS class in uBlock Origin when you only know the prefix of the class, you can use the :remove-class() operator in combination with a wildcard selector. Here’s how you can do it:
:remove-class() with a WildcardIf the class name starts with a known prefix (e.g., prefix-), you can use the following syntax in your uBlock Origin custom filter:
textexample.com##[class^="prefix-"]:remove-class(/^prefix-/)
[class^="prefix-"] selects all elements whose class attribute starts with prefix-.:remove-class(/^prefix-/) removes all classes that start with prefix- from those elements.:watch-attr() for Dynamic ClassesIf the class is added dynamically, you can use :watch-attr() to monitor changes and remove the class as soon as it appears:
textexample.com##[class^="prefix-"]:watch-attr(class):remove-class(/^prefix-/)
/^prefix-/ is a regular expression that matches any class starting with prefix-.Would you like help crafting a specific filter for your use case?
Le Chat can make mistakes. Check answers. Learn more