MCPcopy
hub / github.com/niklasvh/html2canvas / parse

Method parse

src/css/types/functions/counter.ts:27–58  ·  view source on GitHub ↗
(style: CSSParsedCounterDeclaration)

Source from the content-addressed store, hash-verified

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
61interface CounterSymbols {

Callers 15

cloneNodeMethod · 0.80
resolvePseudoContentMethod · 0.80
parseFunction · 0.80
hslFunction · 0.80
parseColorFunction · 0.80
prefixLinearGradientFunction · 0.80
parseColorStopFunction · 0.80
linearGradientFunction · 0.80
webkitGradientFunction · 0.80
colorParseFunction · 0.80
parseFunction · 0.80
colorParseFunction · 0.80

Calls

no outgoing calls

Tested by 10

colorParseFunction · 0.64
parseFunction · 0.64
colorParseFunction · 0.64
parseFunction · 0.64
textShadowParseFunction · 0.64
colorParseFunction · 0.64
backgroundImageParseFunction · 0.64
parseValueFunction · 0.64
paintOrderParseFunction · 0.64
fontFamilyParseFunction · 0.64