Re: [csswg-drafts] [css-lists] Consider new value for counter-reset (#5402)

Republishing B-proposition, with algorithm.

B) a new property **counter-remove** 

property: counter-remove
value: <counter-name>+ \ none
inherited: no

operation of **counter-remove** would precede counter-reset.

It removes named counters coming from the preceding sibling (if exists), so can be reused the named counters of the parent element (if they are in parent's counter set)

This way, each sibling will have the same start value coming from it's parent. So post operation counter-increment, will indicate the same level value for all siblings.



Section [4.4.1](https://www.w3.org/TR/css-lists-3/#inheriting-counters) algorithm for **counter-remove**. New steps 3 and 4 expands from original algorithm step 3.

BEGIN
 
1. Let _element counters_ be an initially empty CSS counters set representing element’s own CSS counters set.

2. If _element_ is the root of its document tree, return. (The element has an initially-empty counter map and inherits nothing.)

3. If the _element_ has a preceding sibling

  1. Let _counter source_ be the CSS counters set of _element_’s preceding sibling.

  2. Let _sibling element_ be the _element_’s preceding sibling

  3. Let _counter to remove_ be the CSS property counter-remove named counters.

  4. For each (_name_, _originating element_, _value_) of _counter source_:

    1. If _counter to remove_ also contains a counter with the same _name_ and _originating element_ is the _sibling element_, then remove a copy of _value source_’s counter (_name_, _originating element_, _value_) from _counter source_.

4. Else Let _counter source_ be the CSS counters set of _element_’s parent.

5. Let _value source_ be the CSS counters set of the element immediately preceding _element_ in tree order.

6. For each (_name_, _originating element_, _value_) of _value source_:

  1. If _counter source_ also contains a counter with the same _name_ and _originating element_, then append a copy of _value source_’s counter (_name_, _originating element_, _value_) to _element counters_.

END

-- 
GitHub Notification of comment by lcchueri
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5402#issuecomment-670285345 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 7 August 2020 02:25:03 UTC