logoalt Hacker News

Izkatatoday at 6:06 AM1 replyview on HN

> .someclass[[ancestor::.mainEntry .headline:empty]]

> or maybe you would prefer

> .mainEntry[[.headline:empty]] .someclass

I don't really know xpath but isn't that this?

.mainEntry:has(.headline:empty) .someClass


Replies

bryanrasmussentoday at 12:18 PM

D'oh! right, got lost in trying to think up a situation nowadays where you can't really do a meaningful query that takes all DOM context into account. Not sure if all edge cases are not actually handled by has and is, actually.