Is this expected behaviour?

Using XPP 9.4 in CSS mode if I have:

para::before { counter-reset: tester 5; content: counter(tester); }

then I get the 5 output before the start of the text, however if I have:

para::after { counter-reset: tester 5; content: counter(tester); }

then the output is zero.

I don't understand why I can't load a value into a counter in the "after" selector - am I missing something?

Parents
  • Chris,

    First of all: I could easily duplicate your problem and in the doc there is nothing that says that the counter-reset property can not be used in a ::before or ::after pseudo element.

    But there is a lot more going on
    I think the whole counter-reset thing seem to be broken.
    I have created the following test case:

    doc {
    	counter-reset: pCounter 5;
    }
    
    p {
    	display: block;
    	counter-increment: pCounter;
    }
    
    p::before {
    	content: counter(pCounter) ". ";
    	
    }

    and that works fine, so you get 6 for the first para and 7 for the next one.

    But if you change things to:

    doc {
    	counter-reset: pCounter 5;
    	counter-reset: pCounter2 6;
    }
    

    Things stop working and the first para is numbered 1, etc
    The same thing happens if you add a second counter-reset statement in your example

    Time to open up a ticket?

Reply
  • Chris,

    First of all: I could easily duplicate your problem and in the doc there is nothing that says that the counter-reset property can not be used in a ::before or ::after pseudo element.

    But there is a lot more going on
    I think the whole counter-reset thing seem to be broken.
    I have created the following test case:

    doc {
    	counter-reset: pCounter 5;
    }
    
    p {
    	display: block;
    	counter-increment: pCounter;
    }
    
    p::before {
    	content: counter(pCounter) ". ";
    	
    }

    and that works fine, so you get 6 for the first para and 7 for the next one.

    But if you change things to:

    doc {
    	counter-reset: pCounter 5;
    	counter-reset: pCounter2 6;
    }
    

    Things stop working and the first para is numbered 1, etc
    The same thing happens if you add a second counter-reset statement in your example

    Time to open up a ticket?

Children