- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Tue, 5 Nov 2013 08:42:18 -0800
- To: Simon Sapin <simon.sapin@exyr.org>
- Cc: Jirka Kosek <jirka@kosek.cz>, www-style list <www-style@w3.org>
On Tue, Nov 5, 2013 at 8:24 AM, Simon Sapin <simon.sapin@exyr.org> wrote: > Le 04/11/2013 12:59, Jirka Kosek a écrit : >> I propose to add new type of simple selector which will allow >> selecting attribute nodes in a document tree. >> >> Proposed syntax is to use @attribute-name syntax, for example: >> >> img @alt -- select alt attributes on images >> >> * @alt -- select all title attributes >> [...] > > > Selecting attributes for a style rule in a CSS stylesheet doesn’t make > sense. So I assume that this new feature would not exist there, only ITS and > possibly Selectors API. > > This means that it’s probably not a problem to use the @name syntax, as > ambiguity with at-rules only exist in CSS stylesheets. I'm uncomfortable with any assertions that inconsistency with CSS stylesheets is okay. Tech has a way of growing together over time. That said, at-keyword tokens inside of selectors are no problem for CSS syntax, as long as they're not the first token (as it'll then look like an at-rule). > That said, I agree with Tab that a syntax pseudo-element like ::attr(name) > is more consistent with the rest of Selectors. > > Regardless of syntax, this would have restrictions similar to > pseudo-elements: the attribute part must be at the end of a selector. Remember that that restriction isn't actually part of the syntax any longer (or rather, we agreed to remove it from the syntax). It's just that several pseudo-elements don't have any children or siblings, so by definition anything following them will cause the match to fail. > (Also, we’ll need terminology to differentiate this for the existing > "attribute selectors", which filter elements based on their attributes.) Attribute pseudo-elements, which select attribute nodes. ~TJ
Received on Tuesday, 5 November 2013 16:43:05 UTC