Skip to content

Commit be364fd

Browse files
committed
Fix end position in empty Custom Properties
1 parent ae33435 commit be364fd

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

lib/parser.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ const SAFE_COMMENT_NEIGHBOR = {
1212
space: true
1313
}
1414

15+
function findLastWithPosition(tokens) {
16+
for (let i = tokens.length - 1; i >= 0; i--) {
17+
let token = tokens[i]
18+
let pos = token[3] || token[2]
19+
if (pos) return pos
20+
}
21+
}
22+
1523
class Parser {
1624
constructor(input) {
1725
this.input = input
@@ -177,7 +185,10 @@ class Parser {
177185
this.semicolon = true
178186
tokens.pop()
179187
}
180-
node.source.end = this.getPosition(last[3] || last[2])
188+
189+
node.source.end = this.getPosition(
190+
last[3] || last[2] || findLastWithPosition(tokens)
191+
)
181192

182193
while (tokens[0][0] !== 'word') {
183194
if (tokens.length === 1) this.unknownWord(tokens)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
"fs-extra": "^10.0.1",
9494
"nanodelay": "^1.0.8",
9595
"nanospy": "^0.5.0",
96-
"postcss-parser-tests": "^8.5.0",
96+
"postcss-parser-tests": "^8.5.1",
9797
"simple-git-hooks": "^2.7.0",
9898
"size-limit": "^7.0.8",
9999
"strip-ansi": "^6.0.1",

pnpm-lock.yaml

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy