Skip to content

Commit

Permalink
fix: CSS implicit list-item counter
Browse files Browse the repository at this point in the history
- fix #1391
  • Loading branch information
MurakamiShinyu committed Oct 17, 2024
1 parent e74884d commit 56941e5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/core/src/vivliostyle/css-cascade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3062,20 +3062,20 @@ export class CascadeInstance {
if (!resetMap) {
resetMap = {};
}
resetMap["ua-list-item"] = ((this.currentElement as any)?.start ?? 1) - 1;
resetMap["list-item"] = ((this.currentElement as any)?.start ?? 1) - 1;
}
if (displayVal === Css.ident.list_item) {
if (!incrementMap) {
incrementMap = {};
}
incrementMap["ua-list-item"] = 1;
incrementMap["list-item"] = incrementMap["list-item"] ?? 1;
if (
/^\s*[-+]?\d/.test(this.currentElement?.getAttribute("value") ?? "")
) {
if (!resetMap) {
resetMap = {};
if (!setMap) {
setMap = {};
}
resetMap["ua-list-item"] = (this.currentElement as any).value - 1;
setMap["list-item"] = (this.currentElement as any).value;
}
}
if (this.currentElement?.parentNode.nodeType === Node.DOCUMENT_NODE) {
Expand Down Expand Up @@ -3137,7 +3137,7 @@ export class CascadeInstance {
}
}
if (displayVal === Css.ident.list_item) {
const listItemCounts = this.counters["ua-list-item"];
const listItemCounts = this.counters["list-item"];
const listItemCount = listItemCounts[listItemCounts.length - 1];
props["ua-list-item-count"] = new CascadeValue(
new Css.Num(listItemCount),
Expand Down

0 comments on commit 56941e5

Please sign in to comment.