- From: fantasai <fantasai.lists@inkedblade.net>
- Date: Wed, 14 Jan 2009 08:51:20 -0800
- To: "Tab Atkins Jr." <jackalmage@gmail.com>
- CC: www-style list <www-style@w3.org>
Tab Atkins Jr. wrote:
> fantasai wrote:
>> :matches would take a normal selector rather than a fragment that
>> begins with a combinator (which seems very unbalanced to me, like
>> passing a mathematical function an expression that began with the
>> multiplication symbol). It would just be restricted to only allow
>> the > and + combinators.
> ...
> Using a full selector doesn't add anything to the proposal, though,
> and using a * specifically seems confusing (it only ever applies to
> the element being matched, but *seems* like it could have wider
> meaning). If we were going to require that, we might as well do it
> properly so that the syntax can be generalized later if we decide it's
> workable. An old proposal used "#" as a placeholder for "the element
> this pseudoclass is applying to". Theoretically the # could be placed
> anywhere in the selector, but for the purpose of this proposal it
> would have to go in the front. Another pseudoclass that I believe I
> proposed (though I was certainly not the first) could be simulated
> with this by placing the # at the end.
>
>> An alternative syntax that was proposed many years ago is to add
>> the ability to change the subject of the selector with some kind
>> of punctuation, e.g.
>>
>> !td > input:checked { ... }
>> !h1 + ul { .. }
Ah, my bad. I wasn't thinking. You'd actually need the bottom syntax
in order for the top to make any sense! The examples should be
:matches(!td > input:checked)
h1:matches(! > input:checked)
With both you can do branching.
:matches(!td > input:checked) + td { /* Select td after a td with child input:checked */
but the simple cases don't require functional notation
!tr > td:first-child > input:checked { /* Select tr with first-child td with input:checked */
Replace ! with $ or whatever symbol...
I think functional notation with :matches is relatively confusing
compared with picking out the subject and saying "I want to match
*this* element in my pattern."
~fantasai
Received on Wednesday, 14 January 2009 17:06:57 UTC