Re: [selectors] Tree selectors

On Mon, 21 Mar 2005, BachusII wrote:
> > 
> > This wouldn't handle, e.g.:
> > 
> >   <body>
> >    <h>
> >    <section>
> >     <h>
> >     <navigation>
> >      <h>
> > 
> > ...where we want the <h>s to render in progressively smaller sizes.
> 
> Could you elaborate on that? I fail to see where/how it fails.

Oops, I made a mistake with my markup. I meant to have:

   <body>
    <h/>
    <section>
     <h/>
     <navigation>
      <h/>

The <h> elements do not contain each other; they are contained inside 
<body>, <section>, and <navigation> elements. These tree elements can be 
arbitrarily nested inside each other and represent different kinds of 
sections. What we want is to find the depth, in sections, of the <h> 
element, and use that depth to give the elements its size.

However, elements other than section elements (i.e., in this case, other 
than <body>, <section>, and <navigation>) should be ignored when 
determining the levels. So the headers in the example above should render 
identically to those in this example:


   <body>
    <h/>
    <form>
     <section>
      <div>
       <h/>
      </div>
      <div>
       <navigation>
        <h/>

...because the <div> and <form> elements don't introduce a new "section" 
nesting level.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Monday, 21 March 2005 12:45:42 UTC