Re: One more list-item thought

On Sun, 14 Sep 2003, staffan.mahlen@comhem.se wrote:
>
> Yes, but could it not be useful to change the way of handling it?
> (please note that i am really not sure myself).

Designing standards tends to go in the opposite direction -- think of
something useful, then try to design it -- rather than specifying
something, then trying to find a use for it! :-) (Granted, sometimes us
W3C members might give one the opposite impression, but...)


> What i am thinking is that possibly the display: list-item way of
> defining it makes for to big a separation from the ::before way of
> doing lists, but they are basically the same concept.

That's what CSS2 thought. We are moving away from that direction because
it caused all kinds of difficult problems.


> The above may all be nitpicking and is not a big issue in actual
> usage, but it think it would be neat if things were defined so that
> li {display: inline}
> would "just work" and render as an inline list with the appropriate
> "indicator" before each item.

I know what you mean, I just don't see a workable way of doing it. At the
moment, making a list-item is as simple as:

   foo { display: list-item; }

...which does _everything_, from setting up the counter to adding a
marker. If we change it to be:

   foo { display: block; }
   foo::marker { content: list-item; }

...then we are making the simple case more complicated. I suppose it could
work... but then you have to define '::marker' on all box types, including
table-cell and table-row and inline... which I suppose wouldn't be
impossible to do... Hmm.

Let me think about this.


> I suppose that depends on what you mean by the rule. To make myself
> more clear test the following in your browsers of choise:
>
>     h2 {display: list-item}
>
>     <h2>First</h2>
>     <h2>Second</h2>
>     <ol>
>       <li>Text
>         <h2>Third</h2>
>         <h2>Fourth</h2>
>       </li>
>       <li>Text</li>
>     </ol>
>     <h2>Fifth</h2>

That would result in:

   1. First
   2. Second
     1. Text
        2. Third
        3. Fourth
     4. Text
   2. Third

...assuming:

   ol:before { counter-reset: list-item; }

...in the UA sheet.

This is correct given the structure. If you don't want that, then you'd
do:

   li::before { counter-reset: list-item; }

...or, more likely:

   h2 { display: list-item; }
   h2::marker {
      content: counter(h2) ".";
      counter-increment: h2 1   list-item -1;
   }

...which I admit sucks. Hmm. Maybe there is value to changing the way
list-item works. How about saying '::marker' is generated whenever its
'content' computes to something other than 'inhibit', but 'normal' for
'::marker' computes to 'inhibit' unless its superior parent's 'display'
computes to 'list-item'? Then 'display:list-item' can still be in charge
of the 'list-item' counter, but to do the h2 case you would just do:

  h2::marker { content: counter(h2) '.'; counter-increment: h2; }

...and not have to change anything else... Hmm... I think that could
work...

-- 
Ian Hickson                                      )\._.,--....,'``.    fL
U+1047E                                         /,   _.. \   _\  ;`._ ,.
http://index.hixie.ch/                         `._.-(,_..'--(,_..'`-.;.'

Received on Sunday, 14 September 2003 08:36:53 UTC