It's 2022 and :only-child isn't aware of text nodes?

I'm trying to select an image that is the only direct descender of an element, with no text node siblings, e.g.:




div img:only-child will select this img in both cases, as will div img:first-child and div img:last-child

Am I missing something?

@omgmog I never stumble on a case like this, probably because I have a compulsion not to leave a text node untagged. In your second example I would have had:


And, off-topic: do we have markdown in Mastodon? I had to refrain from wrapping the above code within ``


@m2m I think not. I've also been resisting the compulsion to wrap `code` with backticks! 😅

Sign in to participate in the conversation

INDIEWEB.SOCIAL is an instance focused on the #Openeb, #Indieweb, #Fediverse, #Mastodon #Selfsovereign #identity (#SSI), #Humanetech and #Calm technologies evolution.