Re: Pseudo-element proposal

On 8/7/12 12:55 PM, "François REMY" <fremycompany_pub@yahoo.fr> wrote:

>Hi,
>
>While I support the need of new pseudo-elements, I've a problem with
>ordinal 
>numbering.
>
>Firstly, ordinal numbering makes it unclear what each pseudo-element is
>doing, which is bad for a readability point of view (I know that at Adobe
>you work mostly on HTML generators which don't care too much about this,
>because generators have other solutions than compiled source code to find
>their way, but features shipped in CSS should be as much as possible
>author-friendly). 

I agree that ordinals (and indices) do not describe what the
pseudo-element is being used for. But ordinals do at least indicate
ordering, which I think is also important for readability.

>Secondly, when pseudo-elements are inserted or removed,
>the reordering can become a nightmare.

That's one problem that ordinals are meant to solve. If you know that
pseudo-elements will be inserted or removed, you can choose ordinal
spacing that allows for these changes without having to re-order
everything. In your proposal to add slots to the content attribute,
re-ordering can only be achieved by changing the entire content attribute.
You have to re-order everything to make a single insertion or removal,
which seems more nightmarish to me.

>
>I know I already proposed the syntax in the [1] comment thread (and I
>agree 
>it comes with its own pitfalls) but I think a slot-based solution is
>better 
>suited to solve this problem:
>
>    element::before {
>        content: slot(absolute counter) slot(absolute bubble)
>slot(absolute 
>bubble) open-quote;
>    }
>
>    element::after {
>        content: close-quote;
>    }
>
>    element::slots(absolute) {
>        position: absolute;
>    }
>
>    element::slots(bubble) {
>        content: "";
>        background-color: ...;
>        ...
>    }
>
>    element::nth-slot(bubble, 0) {
>        bottom: ...; left: ...; ...
>    }
>
>    element::nth-slot(bubble, 1) {
>        bottom: ...; left: ...; ...
>    }
>
>    element::nth-slot(counter, 0) {
>        content: attr(data-counter);
>        top: ...; right: ...; ...
>    }
>
>
>
>Key features:
>
>- Slots have one or more class names, which make their selection easy and
>semantic.
>- Indexes are relative to their class names, which create an isolation
>between unrelated slots.
>- Slots can be defined in any of the available root pseudos (::after,
>::before, ...) or, in the future, as part of the generated content of the
>element itself.
>
>Best regards,
>François

Received on Tuesday, 7 August 2012 20:40:45 UTC