Re: Pseudo-element proposal

|  From: Alan Stearns
|  >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 don't know which kind of metric you're using for that kind of purpose. For 
myself, I use the "number of spot changes" one (I count the number of points 
where I've to move the textedit cursor to in order to make a change). The 
number of spot changes is largely in favor of class names.

[A] In the case I want to add a new pseudo-element in the first position of 
the list

    1) Ordinals:

        - I've to add a new selector for the pseudo-element, for which 
position will be one (one spot)

        - I've to increment the value of every ordinal in every selector 
which applies on the element (n spots)

        - Complexity: O(n) with 'n' the number of pseudo-elements

    2) Class names:

        - I've to add a "slot(...)" value in first position of the "content" 
declaration (one spot).

        - I've to add a new selector for the element, if it requires 
specific styling not covered by previous clas names (one or zero spot).

        - Complexity: 1 or 2

[B] In the case I want to insert a new pseudo-element in the last position 
of the list

    1) Ordinals:

        - I've to count how many pseudo I already use (one spot, if code is 
ordered)

        - I've to add a new selector for the pseudo-element, for which 
position will be that number (one spot)

        - Complexity: 2

    2) Class names:

        - I've to add a "slot(...)" value in first position of the "content" 
declaration (one spot).

        - I've to add a new selector for the element, if it requires 
specific styling not covered by previous clas names (one or zero spot).

        - Complexity: 1 or 2

[C] In the case I want to delete a pseudo-element anywhere in the list

    1) Ordinals:

        - I've to delete the rule that create it (one spot)

        - I've to check all the ::before() + ::nth-pseudo() and edit their 
numbering if needed (n spots)

        - Complexity: O(n)

    2) Class names:

        - I've to remove a "slot(...)" value in the "content" declaration 
(one spot).

        - I've to check all the ::nth-slot() and edit their numbering if 
needed (n spots)

        - Complexity: O(n) but if you rely on class names only or mostly, 
this can be down to a complexity of just '1'


François 

Received on Tuesday, 7 August 2012 21:09:16 UTC