Commit de897c4
committed
fix: trim whitespace in polygon clip-path point parsing
Fixes #763
The parsePolygon function split comma-separated points without trimming
whitespace first. When CSS like 'polygon(100% 0, 81.844% 100%)' was
parsed, the space after each comma created a phantom empty-string element
during the subsequent .split(' '), causing x-coordinates to be resolved
against height instead of width for all points except the first.
This was invisible in tests because existing tests used square elements
(width === height). Adding .trim() before .split(/\s+/) ensures correct
index mapping for the width/height resolution.1 parent b712d5b commit de897c4
4 files changed
Lines changed: 21 additions & 1 deletion
File tree
- .husky
- src/parser
- test
- __image_snapshots__
File mode changed.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
| 127 | + | |
| 128 | + | |
128 | 129 | | |
129 | 130 | | |
130 | 131 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
107 | 126 | | |
108 | 127 | | |
109 | 128 | | |
| |||
0 commit comments