@projectwallace/css-parser 0.8.7 → 0.8.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -335,6 +335,8 @@ class AtRulePreludeParser {
335
335
  if (trimmed) {
336
336
  this.arena.set_content_start_delta(layer_node, trimmed[0] - layer_start);
337
337
  this.arena.set_content_length(layer_node, trimmed[1] - trimmed[0]);
338
+ this.arena.set_value_start_delta(layer_node, trimmed[0] - layer_start);
339
+ this.arena.set_value_length(layer_node, trimmed[1] - trimmed[0]);
338
340
  }
339
341
  }
340
342
  return layer_node;
@@ -351,8 +353,10 @@ class AtRulePreludeParser {
351
353
  let text = this.source.substring(this.lexer.token_start, this.lexer.token_end - 1);
352
354
  if (str_equals("supports", text)) {
353
355
  let supports_start = this.lexer.token_start;
356
+ let content_start = this.lexer.token_end;
354
357
  let paren_depth = 1;
355
358
  let supports_end = this.lexer.token_end;
359
+ let content_end = content_start;
356
360
  while (this.lexer.pos < this.prelude_end && paren_depth > 0) {
357
361
  let tokenType = this.next_token();
358
362
  if (tokenType === TOKEN_LEFT_PAREN || tokenType === TOKEN_FUNCTION) {
@@ -360,6 +364,7 @@ class AtRulePreludeParser {
360
364
  } else if (tokenType === TOKEN_RIGHT_PAREN) {
361
365
  paren_depth--;
362
366
  if (paren_depth === 0) {
367
+ content_end = this.lexer.token_start;
363
368
  supports_end = this.lexer.token_end;
364
369
  }
365
370
  } else if (tokenType === TOKEN_EOF) {
@@ -367,6 +372,11 @@ class AtRulePreludeParser {
367
372
  }
368
373
  }
369
374
  let supports_node = this.create_node(SUPPORTS_QUERY, supports_start, supports_end);
375
+ let trimmed = trim_boundaries(this.source, content_start, content_end);
376
+ if (trimmed) {
377
+ this.arena.set_value_start_delta(supports_node, trimmed[0] - supports_start);
378
+ this.arena.set_value_length(supports_node, trimmed[1] - trimmed[0]);
379
+ }
370
380
  return supports_node;
371
381
  }
372
382
  }
@@ -43,7 +43,9 @@ class DeclarationParser {
43
43
  browser_hack_line = lexer.token_line;
44
44
  browser_hack_column = lexer.token_column;
45
45
  } else if (first_char === 45) {
46
- if (!is_vendor_prefixed(this.source, lexer.token_start, lexer.token_end)) {
46
+ const second_char = this.source.charCodeAt(lexer.token_start + 1);
47
+ const is_custom_property = second_char === 45;
48
+ if (!is_custom_property && !is_vendor_prefixed(this.source, lexer.token_start, lexer.token_end)) {
47
49
  has_browser_hack = true;
48
50
  browser_hack_start = lexer.token_start;
49
51
  browser_hack_line = lexer.token_line;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectwallace/css-parser",
3
- "version": "0.8.7",
3
+ "version": "0.8.8",
4
4
  "description": "High-performance CSS lexer and parser, optimized for CSS inspection and analysis",
5
5
  "author": "Bart Veneman <bart@projectwallace.com>",
6
6
  "license": "MIT",