Ensure Parsoid's linkback ref CSS counters are properly incremented

* Turned out there were 2 counters defined on references li nodes.
* One was added as part of the extends functionality added by WMDE's
  book referenceing project.
* The other one was added as part of Parsoid's Cite CSS work.
* Since the counter increments were defined separately and applied
  to the same node, only one of the increments would apply.
  This breaks counter rendering on wikis where custom wiki-specific
  rules aren't defined in that wiki's Mediawiki:Common.css
* Discovered after running visual diff tests after ad919e37
  was deployed.

Change-Id: I826faac3564d63b8a4fbd80015fd5cc8f0069b7a
This commit is contained in:
Subramanya Sastry 2022-12-16 15:42:17 -06:00
parent fef36c2da9
commit ea4c16c037
2 changed files with 38 additions and 8 deletions

View file

@ -56,13 +56,34 @@ span.mw-reflink-text {
/* Style for linkbacks from <references> to <ref>s */
ol.mw-references {
/* Resetting *any* counter on an <ol> element messes up the built-in numbering in Firefox.
Explicitly resetting the built-in "list-item" counter fixes this. */
counter-reset: mw-references list-item 0;
/**
* Resetting *any* counter on an <ol> element messes up the built-in numbering in Firefox.
* Explicitly resetting the built-in "list-item" counter fixes this.
*
* We have 2 counters for Parsoid HTML for different functionality.
* Make sure both are reset!
*
* NOTE: This rule is a duplicate of the one present in ext.cite.styles.css
* but duplicating it here ensures no matter how the rules and files are
* refactored and which rule ends up applying on the loaded doc, both
* counters continue to be incremented. As of now, the rule in ext.cite.styles.css
* is the one that seems to be winning.
**/
counter-reset: mw-ref-extends-parent mw-references list-item;
}
ol.mw-references > li {
counter-increment: mw-references;
/**
* We have 2 counters for Parsoid HTML for different functionality.
* Make sure both are incremented!
*
* NOTE: This rule is a duplicate of the one present in ext.cite.styles.css
* but duplicating it here ensures no matter how the rules and files are
* refactored and which rule ends up applying on the loaded doc, both
* counters continue to be incremented. As of now, the rule in ext.cite.styles.css
* is the one that seems to be winning.
**/
counter-increment: mw-ref-extends-parent mw-references;
}
ol[ data-mw-group='lower-alpha' ].mw-references > li {

View file

@ -26,13 +26,22 @@
}
ol.references {
/* Resetting *any* counter on an <ol> element messes the build-in numbering in Firefox up.
Explicitely resetting the build-in "list-item" counter fixes this. */
counter-reset: mw-ref-extends-parent list-item;
/**
* Resetting *any* counter on an <ol> element messes up the built-in numbering in Firefox.
* Explicitly resetting the built-in "list-item" counter fixes this.
*
* We have 2 counters for Parsoid HTML for different functionality.
* Make sure both are reset!
**/
counter-reset: mw-ref-extends-parent mw-references list-item;
}
ol.references > li {
counter-increment: mw-ref-extends-parent;
/**
* We have 2 counters for Parsoid HTML for different functionality.
* Make sure both are incremented!
**/
counter-increment: mw-ref-extends-parent mw-references;
counter-reset: mw-ref-extends-child;
}