Re: Parent Combinator / Parent pseudo-class

Brad Kemper wrote:
>
> On Jul 23, 2008, at 4:31 AM, Alan Gresley wrote:
>
>> Stephen wrote:
>>> Ingo Chao wrote:
>>>> 2008/7/19 Stephen <w3mail@jixor.com <mailto:w3mail@jixor.com>>:
>>>>
>>>>> ...
>>>>> My concept is that it should be possible to target an element with 
>>>>> specific
>>>>> children...
>>>>>    
>>>>
>>>> div:with-child(h5) {
>>>>  float: left;
>>>>  overflow: hidden;
>>>> }
>>>>
>>>> I think that would cause a reflow of what is already rendered of the
>>>> div when a h5 is encountered.
>>>>
>>>> regards
>>>>  
>>> I have considered this and to me it would be a matter of choice, a 
>>> developer would be aware that it could cause awkward adjustments 
>>> however for the rendering engine one would expect it would be no 
>>> different to doing it with javascript, which is a quite simple 
>>> process, but not really satisfactory as I tend to prefer to avoid js 
>>> as much as possible for obvious reasons.
>>
>>
>> A parent combinator pseudo-class or parent pseudo-class requires a 
>> CSS parser to walk the chain. 
>
> Only of immediate children, not of all descendants of a particular 
> has-child selector. Anyone using it more than sparingly should expect 
> some performance degradation.
>
Would a possible compromise be to use something like "has-first-child". 
That said I really think it should be up to a particular author to 
decide. As we do now when deciding to use flash, javascript, big images, 
etc. So I really don't think that performance degradation is any reason 
at all to discard this suggestion.

Received on Wednesday, 6 August 2008 14:00:42 UTC