Skip to content

Commit

Permalink
fix: 'start' and 'value' attributes on OL and LI elements are ignored
Browse files Browse the repository at this point in the history
Fixes #654
  • Loading branch information
MurakamiShinyu committed Sep 22, 2020
1 parent bf51734 commit 0aea654
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions packages/core/src/vivliostyle/css-cascade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2583,7 +2583,6 @@ export class CascadeInstance {
viewConditions: { [key: string]: Matchers.Matcher[] } = {};
dependentConditions: string[] = [];
elementStack: Element[];
currentDoc?: Document | null;

constructor(
cascade: Cascade,
Expand Down Expand Up @@ -2747,13 +2746,21 @@ export class CascadeInstance {
if (!resetMap) {
resetMap = {};
}
resetMap["ua-list-item"] = 0;
resetMap["ua-list-item"] = ((this.currentElement as any)?.start ?? 1) - 1;
}
if (displayVal === Css.ident.list_item) {
if (!incrementMap) {
incrementMap = {};
}
incrementMap["ua-list-item"] = 1;
if (
/^\s*[-+]?\d/.test(this.currentElement?.getAttribute("value") ?? "")
) {
if (!resetMap) {
resetMap = {};
}
resetMap["ua-list-item"] = (this.currentElement as any).value - 1;
}
}
if (resetMap) {
for (const resetCounterName in resetMap) {
Expand Down Expand Up @@ -2853,14 +2860,6 @@ export class CascadeInstance {
} else {
this.currentEpubTypes = EMPTY;
}
if (
this.currentLocalName == "style" &&
this.currentNamespace == Base.NS.FB2
) {
// special case
const className = element.getAttribute("name") || "";
this.currentClassNames = [className];
}
const lang = Base.getLangAttribute(element);
if (lang) {
this.stack[this.stack.length - 1].push(new RestoreLangItem(this.lang));
Expand Down Expand Up @@ -3003,8 +3002,7 @@ export class CascadeInstance {
// CSS
this.applyAction(this.code.pagetypes, "*");
}
this.currentElement = null;
this.currentDoc = null;

this.stack.push([]);
for (let depth = 1; depth >= -1; --depth) {
const list = this.stack[this.stack.length - depth - 2];
Expand Down

0 comments on commit 0aea654

Please sign in to comment.