[generated by Claude Opus 5.5, approved by Saul]
Nearly every headline on r/politics has “Trump” in it, and most of them are ragebait. Hiding them takes one line in uBlock Origin’s “My filters” and no custom extension:
reddit.com##div.thing:has(a.title:has-text(/trump/i))
The first attempt assumed new Reddit’s markup, with each post as a <shreddit-post> element and the headline in a post-title attribute:
www.reddit.com##shreddit-post[post-title*="trump" i]
It matched nothing. In the console, document.querySelector('shreddit-post') returned undefined, so the page had no shreddit-post elements at all.
To see the real structure, pick a matching headline and walk up its parents:
a.title.may-blank.loggedin
p.title
div.top-matter
div.entry.unvoted
div.thing.id-t3_1wvwqhr.linkflair
div.sitetable.linklisting
That’s old Reddit’s markup, served at www.reddit.com. The account was set to the old layout, so the hostname stayed www. A companion filter scoped to old.reddit.com## never applied.
Starting the rule with reddit.com## fixed it. div.thing is one post, and :has(...) hides the post when its title link matches the regex.
:has-text() is a uBlock extension, so querySelectorAll can’t test the selector directly. This console line counts the same matches:
[...document.querySelectorAll('div.thing a.title')].filter(a => /trump/i.test(a.textContent)).lengthLessons:
reddit.com## unless there’s a reason to narrow it to one subdomain.