During browsing when I click an element
<body>
changes to
<body class="xyz">
Is it possible to remove this class dynamically using uBlock Origin? Expected behavior: when I click this element, <body>
does not change.
remove-attr.js (suggested by this answer) does not work because class "xyz" is not present at the time when the page is loaded.
For those looking to remove the class on pageload, you can now use the :remove-class(class)
action operator in uBlock. There is also :remove-attr(attr)
as well.
www.example.com##body:remove-class(xyz)
Wiki article: https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#subjectremove-attrarg-subjectremove-classarg
If the class only appears later (e.g. dynamically on click), try prepending with the watch-attr(arg)
filter:
www.example.com##body:watch-attr(class):remove-class(xyz)
Wiki article: https://github.com/gorhill/uBlock/wiki/Procedural-cosmetic-filters#subjectwatch-attrarg