- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Tue, 5 Nov 2013 07:49:31 -0800
- To: Jirka Kosek <jirka@kosek.cz>
- Cc: www-style list <www-style@w3.org>
On Tue, Nov 5, 2013 at 12:31 AM, Jirka Kosek <jirka@kosek.cz> wrote: > On 5.11.2013 2:30, Tab Atkins Jr. wrote: >> Rather than consuming a new ASCII character, we could just pile this >> onto pseudo-element syntax: >> >> img::attr(alt) >> >> ::attr(title) > > This would work, but it seems little counter-intuitive as > pseudo-elements until now were defined as elements not represented in > the document tree. So using same mechanism for attributes (which are not > elements) and are presented in the document tree doesn't seem consistent. Pseudo-element represent all *kinds* of things. They're much more than just ::before and ::after. ::region, for example, switches the context of the rest of the selector. In general, pseudo-elements are just a "context switch" operator. Sometimes that's a switch into the pseudo-tree, containing <before>, <after>, etc. Sometimes it's more abstract. In this case it would be a switch into the attr tree, containing all the element's attributes. > If using @ is a real problem another possibility is to extend subject > operator (!) to cover attribute selectors as well, so above queries > could be written as: > > img[!alt] > > [!title] Nah, punning on that would be confusing, I think. > But personally I would stick with @ as it's really meme for choosing > attributes. I see the value in that. ~TJ
Received on Tuesday, 5 November 2013 15:50:22 UTC