Re: Parent Combinator / Parent pseudo-class

On Fri, Jul 25, 2008 at 4:30 PM, Andrew Fedoniouk <news@terrainformatica.com>
wrote:

> Tab Atkins Jr. wrote:
>
>> On Fri, Jul 25, 2008 at 10:56 AM, Brad Kemper <brkemper@comcast.net<mailto:
>> brkemper@comcast.net>> wrote:
>>
>>
>>    Consider the following:
>>
>>    div:with-child(code) { border:2px solid #999;
>>    background-color:beige; }
>>    div:with-child(code):before { content:"See Code:"; }
>>
>>    I would only want this on DIVs that surrounded the Code block
>>    directly, not on any old DIV that happened to be an ancestor of
>>    the code block.
>>
>>
>> Nod, searching for just children would certainly be useful.  That's why my
>> proposal was for a simple selector preceded by a combinator.  You'd do this:
>>
>> div:matches( > code ) { border:2px solid #999; background-color:beige; }
>> div:matches( > code ):before { content:"See Code:"; }
>>
> That is again subject of :root/:scope debate :)


What?  No it's not.  The :scope debate was about a javascript querySelector
function, and whether we'd ever want to query higher in the document than
the current element.  Within a normal selector, if you want to match against
something higher in the document, *you just put it earlier in the
selector*.  There would never be any need for :matches to query higher up in
the DOM, and so it clearly matches from the 'current node' in the selector.

I don't want to reopen the :scope debate in this thread (if you do, go back
to the thread it appeared in), I just don't understand what relevance :scope
could possible have here.

~TJ

Received on Friday, 25 July 2008 22:51:35 UTC