(style: CSSParsedCounterDeclaration)
| 25 | } |
| 26 | |
| 27 | parse(style: CSSParsedCounterDeclaration): string[] { |
| 28 | const counterIncrement = style.counterIncrement; |
| 29 | const counterReset = style.counterReset; |
| 30 | let canReset = true; |
| 31 | |
| 32 | if (counterIncrement !== null) { |
| 33 | counterIncrement.forEach((entry) => { |
| 34 | const counter = this.counters[entry.counter]; |
| 35 | if (counter && entry.increment !== 0) { |
| 36 | canReset = false; |
| 37 | if (!counter.length) { |
| 38 | counter.push(1); |
| 39 | } |
| 40 | counter[Math.max(0, counter.length - 1)] += entry.increment; |
| 41 | } |
| 42 | }); |
| 43 | } |
| 44 | |
| 45 | const counterNames: string[] = []; |
| 46 | if (canReset) { |
| 47 | counterReset.forEach((entry) => { |
| 48 | let counter = this.counters[entry.counter]; |
| 49 | counterNames.push(entry.counter); |
| 50 | if (!counter) { |
| 51 | counter = this.counters[entry.counter] = []; |
| 52 | } |
| 53 | counter.push(entry.reset); |
| 54 | }); |
| 55 | } |
| 56 | |
| 57 | return counterNames; |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | interface CounterSymbols { |
no outgoing calls