csstree

Frameworks & LibrariesMIT

csstree release notes.

Latest v3.2.1 · by csstreeWritten in JavaScriptWebsitecsstree/csstreeRSS

Release activity

Release activity — 2 releases across 1 day in the last year. Each cell is one day; darker means more releases that day. Older weeks are hidden at this screen width.
JunJulAugSep
SundayNo releases on May 24, 2026No releases on May 31, 2026No releases on Jun 7, 2026No releases on Jun 14, 2026No releases on Jun 21, 2026No releases on Jun 28, 2026No releases on Jul 5, 2026No releases on Jul 12, 2026No releases on Jul 19, 2026No releases on Jul 26, 2026No releases on Aug 2, 2026No releases on Aug 9, 2026No releases on Aug 16, 2026No releases on Aug 23, 2026No releases on Aug 30, 2026No releases on Sep 6, 2026
MondayNo releases on May 25, 2026No releases on Jun 1, 2026No releases on Jun 8, 2026No releases on Jun 15, 2026No releases on Jun 22, 2026No releases on Jun 29, 2026No releases on Jul 6, 2026No releases on Jul 13, 2026No releases on Jul 20, 2026No releases on Jul 27, 2026No releases on Aug 3, 2026No releases on Aug 10, 2026No releases on Aug 17, 2026No releases on Aug 24, 2026No releases on Aug 31, 2026No releases on Sep 7, 2026
TuesdayNo releases on May 26, 2026No releases on Jun 2, 2026No releases on Jun 9, 2026No releases on Jun 16, 2026No releases on Jun 23, 2026No releases on Jun 30, 2026No releases on Jul 7, 2026No releases on Jul 14, 2026No releases on Jul 21, 2026No releases on Jul 28, 2026No releases on Aug 4, 2026No releases on Aug 11, 2026No releases on Aug 18, 2026No releases on Aug 25, 2026No releases on Sep 1, 2026No releases on Sep 8, 2026
WednesdayNo releases on May 27, 2026No releases on Jun 3, 2026No releases on Jun 10, 2026No releases on Jun 17, 2026No releases on Jun 24, 2026No releases on Jul 1, 2026No releases on Jul 8, 2026No releases on Jul 15, 2026No releases on Jul 22, 2026No releases on Jul 29, 2026No releases on Aug 5, 2026No releases on Aug 12, 2026No releases on Aug 19, 2026No releases on Aug 26, 2026No releases on Sep 2, 2026No releases on Sep 9, 2026
ThursdayNo releases on May 28, 2026No releases on Jun 4, 2026No releases on Jun 11, 2026No releases on Jun 18, 2026No releases on Jun 25, 2026No releases on Jul 2, 2026No releases on Jul 9, 2026No releases on Jul 16, 2026No releases on Jul 23, 2026No releases on Jul 30, 2026No releases on Aug 6, 2026No releases on Aug 13, 2026No releases on Aug 20, 2026No releases on Aug 27, 2026No releases on Sep 3, 2026No releases on Sep 10, 2026
FridayNo releases on May 29, 2026No releases on Jun 5, 2026No releases on Jun 12, 2026No releases on Jun 19, 2026No releases on Jun 26, 2026No releases on Jul 3, 2026No releases on Jul 10, 2026No releases on Jul 17, 2026No releases on Jul 24, 2026No releases on Jul 31, 2026No releases on Aug 7, 2026No releases on Aug 14, 2026No releases on Aug 21, 2026No releases on Aug 28, 2026No releases on Sep 4, 2026
SaturdayNo releases on May 30, 2026No releases on Jun 6, 2026No releases on Jun 13, 2026No releases on Jun 20, 2026No releases on Jun 27, 2026No releases on Jul 4, 2026No releases on Jul 11, 2026No releases on Jul 18, 2026No releases on Jul 25, 2026No releases on Aug 1, 2026No releases on Aug 8, 2026No releases on Aug 15, 2026No releases on Aug 22, 2026No releases on Aug 29, 2026No releases on Sep 5, 2026

2 releases in the last year, busiest day 2

Changelog

What changed from 2 to 3
v3.2.1Latest

3.2.1

  • Fixed parsing of nested function in a group in definition syntax (#358)
View originalPermalink
How v3.2.1 went
v3.2.0

3.2.0

Added 11
  • Added `"sideEffects": false` in `package.json`
  • Added `list` option to the `parse()` method to specify whether the parser should produce a `List` (by default, `list: true`) or an array (`list: false`) for node's children
  • Added support for Functional Notation in definition syntax by wrapping function arguments into an implicit group when necessary
  • Added support for stacked multipliers `{A}?` and `{A,B}?` according to spec in definition syntax parsing
  • Added math functions support in syntax matching (e.g., `min()`, `max()`, etc.)
  • Added `onToken` option to the `parse()` method, which can be either an array or a function for token handling with type, start, end, and index parameters
Changed 1
  • Changed `generate()` to not auto insert whitespaces between tokens for raw values
Fixed 1
  • Fixed `fork()` to extend `node` definitions instead of overriding them

From csstree

  • Added "sideEffects": false in package.json
  • Added list option to the parse() method to specify whether the parser should produce a List (by default, list: true) or an array (list: false) for node's children (e.g., SelectorList, Block, etc.)
  • Added support for Functional Notation in definition syntax (for now by wrapping function arguments into an implicit group when necessary, see #292)
  • Added support for stacked multipliers {A}? and {A,B}? according to spec in definition syntax parsing (#346)
  • Added math functions support in syntax matching (e.g., min(), max(), etc.) (#344)
  • Added onToken option to the parse() method, which can be either an array or a function:
    • When the value is an array, it is populated with objects { type, start, end } (token type, and its start and end offsets).
    • When the value is a function, it accepts type, start, end, and index parameters, and is invoked with a token API as this, enabling advanced token handling (see onToken). For example, the following demonstrates checking if all block tokens have matching pairs:
      parse(css, {
          onToken(type, start, end, index) {
              if (this.isBlockOpenerTokenType(type)) {
                  if (this.getBlockPairTokenIndex(index) === -1) {
                      console.warn('No closing pair for', this.getTokenValue(index), this.getRangeLocation(start, end));
                  }
              } else if (this.isBlockCloserTokenType(type)) {
                  if (this.getBlockPairTokenIndex(index) === -1) {
                      console.warn('No opening pair for', this.getTokenValue(index), this.getRangeLocation(start, end));
                  }
              }
          }
      });
      
  • Extended TokenStream with the following methods:
    • getTokenEnd(tokenIndex) – returns the token's end offset by index, complementing getTokenStart(tokenIndex)
    • getTokenType(tokenIndex) – returns the token's type by index
    • isBlockOpenerTokenType(tokenType) – returns true for <function-token>, <(-token>, <[-token>, and <{-token>
    • isBlockCloserTokenType(tokenType) – returns true for <)-token>, <]-token>, and <}-token>
    • getBlockTokenPairIndex(tokenIndex) – returns the index of the pair token for a block, or -1 if no pair exists
  • Changed generate() to not auto insert whitespaces between tokens for raw values (#356)
  • Fixed fork() to extend node definitions instead of overriding them. For example, fork({ node: { Dimension: { generate() { /* ... */ } } } }) will now update only the generate() method on the Dimension node, while inheriting all other properties from the previous syntax definition.
  • Bumped mdn/data to 2.27.1 and various fixes in syntaxes
View originalPermalink
How v3.2.0 went
v3.1.0

3.1.0

Added 3
  • Support for boolean expression multiplier in syntax definition, i.e. `<boolean-expr[ test ]>`
  • Add `source`, `startOffset`, `startLine`, and `startColumn` parameters to `OffsetToLocation` constructor
  • Expose `OffsetToLocation` class in the main entry point
Fixed 4
  • Fix `Raw` node value consumption by ignoring stop tokens inside blocks
  • Fix `TokenStream#balance` computation to handle unmatched brackets correctly
  • Fix syntax definition parser to allow a token to be followed by a multiplier
  • Fix location for `Layer` node

From csstree

  • Added support for boolean expression multiplier in syntax definition, i.e. <boolean-expr[ test ]> (#304)
  • Added source, startOffset, startLine, and startColumn parameters to OffsetToLocation constructor, eliminating the need to call setSource() after creating a new OffsetToLocation instance
  • Exposed OffsetToLocation class in the main entry point, which was previously accessible only via css-tree/tokenizer
  • Fixed Raw node value consumption by ignoring stop tokens inside blocks, resolving an issue where Raw value consumption stopped prematurely. This fix also enables parsing of functions whose content includes stop characters (e.g., semicolons and curly braces) within declaration values, aligning with the latest draft of CSS Values and Units L5.
  • Fixed TokenStream#balance computation to handle unmatched brackets correctly. Previously, when encountering a closing bracket, the TokenStream would prioritize it over unmatched opening brackets, leading to improper parsing. For example, the parser would incorrectly consume the declaration value of .a { prop: ([{); } as ([{) instead of consuming it until all opened brackets were closed (([{); }). Now, unmatched closing brackets are discarded unless they match the most recent opening bracket on the stack. This change aligns CSSTree with CSS specifications and browser behavior.
  • Fixed syntax definition parser to allow a token to be followed by a multiplier (#303)
  • Fixed location for Layer node (#310)
  • Bumped mdn/data to 2.12.2
View originalPermalink
How v3.1.0 went
v3.0.1

3.0.1

Added 2
  • Added errors array to the Lexer#validate() method result, providing details on problematic syntax
  • Added Lexer#cssWideKeywords dictionary to list CSS-wide keywords
Changed 4
  • Bumped mdn/data to 2.12.1
  • Updated the Lexer's constructor to consider config.cssWideKeywords for overriding the default list
  • Expanded the lexer's dump output to include the cssWideKeywords dictionary
  • Modified the fork() method to accept a cssWideKeywords option, allowing the addition of new keywords to the existing list
Fixed 2
  • Reverted changes to Block to include { and }, and Atrule and Rule to exclude { and } for a block
  • Fixed syntaxes for <basic-shapes>, <absolute-color-function> and <'stroke-opacity'>
Removed 1
  • Removed second parameter (assign) for the callback in the fork() method

From csstree

  • Bumped mdn/data to 2.12.1
  • Added errors array to the Lexer#validate() method result, providing details on problematic syntax.
  • Added CSS wide keyword customization and introspection:
    • Added a Lexer#cssWideKeywords dictionary to list CSS-wide keywords
    • Updated the Lexer's constructor to consider config.cssWideKeywords for overriding the default list
    • Expanded the lexer's dump output to include the cssWideKeywords dictionary
    • Modified the fork() method to accept a cssWideKeywords option, allowing the addition of new keywords to the existing list
  • Reverted changes to Block to include { and }, and Atrule and Rule to exclude { and } for a block (#296)
  • Removed second parameter (assign) for the callback in the fork() method (e.g., syntax.fork((config, assign) => { ... })), as it simply refers to Object.assign()
  • Fixes in syntaxes: <basic-shapes>, <absolute-color-function> and <'stroke-opacity'>
View originalPermalink
How v3.0.1 went
v3.0.0

3.0.0

Added 13
  • Support for the @container at-rule
  • Support for the @starting-style at-rule
  • Support for the @scope at-rule
  • Support for the @position-try at-rule
  • Support for the @layer at-rule
  • Support for layer, layer() and supports() in the @media at-rule
Changed 8
  • Aligned <'font'> to CSS Fonts 4
  • Aligned <color> to CSS Color 5
  • Block to not include { and }
  • Atrule and Rule to include { and } for a block
  • Ratio parsing to use nodes instead of strings for left and right parts, allow any number for both parts, support functions in both parts, and permit omitting the right part
  • MediaFeature node type transitioned to Feature node type with kind: "media" in @media at-rule
  • MediaQuery node structure to include modifier, mediaType, and condition properties
  • parseWithFallback() to rollback tokenIndex before calling a fallback
Fixed 7
  • Initialization when Object.prototype is extended or polluted
  • fork() method to consider the generic option when creating a Lexer instance
  • Crash on parse error when custom line or offset is specified via options
  • speak syntax patch
  • :lang() to accept a list of <ident> or <string> per spec
  • Lexer matching for syntaxes referred to as <'property'> when the syntax has a top-level #-multiplier
  • Parsing of syntax definition to allow whitespaces in range multiplier

From csstree

  • Added support for the @container at-rule
  • Added support for the @starting-style at-rule
  • Added support for the @scope at-rule
  • Added support for the @position-try at-rule
  • Added support for the @layer at-rule
  • Added support for layer, layer() and supports() in the @media at-rule (according to the @import rule in Cascading and Inheritance 5)
  • Added Layer and LayerList node types
  • Added TokenStream#lookupTypeNonSC() method
  • Added <dashed-ident> to generic types
  • Bumped mdn/data to 2.10.0
  • Aligned <'font'> to CSS Fonts 4
  • Aligned <color> to CSS Color 5
  • Fixed initialization when Object.prototype is extended or polluted (#262)
  • Fixed fork() method to consider the generic option when creating a Lexer instance (#266)
  • Fixed crash on parse error when custom line or offset is specified via options (#251)
  • Fixed speak syntax patch (#241)
  • Fixed :lang() to accept a list of <ident> or <string> per spec (#265)
  • Fixed lexer matching for syntaxes referred to as <'property'>, when the syntax has a top-level #-multiplier (#102)
  • Relaxed parsing of syntax definition to allow whitespaces in range multiplier (#270)
  • Changed parseWithFallback() to rollback tokenIndex before calling a fallback
  • Changed Block to not include { and }
  • Changed Atrule and Rule to include { and } for a block
  • Changed Ratio parsing:
    • Left and right parts contain nodes instead of strings
    • Both left and right parts of a ratio can now be any number; validation of number range is no longer within the parser's scope.
    • Both parts can now be functions. Although not explicitly mentioned in the specification, mathematical functions can replace numbers, addressing potential use cases (#162).
    • As per the CSS Values and Units Level 4 specification, the right part of Ratio can be omitted. While this can't be a parser output (which would produce a Number node), it's feasible during Ratio node construction or transformation.
  • Changes to query-related at-rules:
    • Added new node types:
      • Feature: represents features like (feature) and (feature: value), fundamental for both @media and @container at-rules
      • FeatureRange: represents features in a range context
      • FeatureFunction: represents functional features such as @supports's selector() or @container's style()
      • Condition: used across all query-like at-rules, encapsulating queries with features and the not, and, and or operators
      • GeneralEnclosure: represents the <general-enclosed> production, which caters to unparsed parentheses or functional expressions

      Note: All new nodes include a kind property to define the at-rule type. Supported kinds are media, supports, and container

    • Added support for functions for features and features in a range context, e.g. (width: calc(100cm / 6))
    • Added a condition value for the parser's context option to parse queries. Use the kind option to specify the condition type, e.g., parse('...', { context: 'condition', kind: 'media' })
    • Introduced a features section in the syntax configuration for defining functional features of at-rules. Expand definitions using the fork() method. The current definition is as follows:
      features: {
          supports: { selector() { /* ... */ } },
          container: { style() { /* ... */ } }
      }
      
    • Changes for @media at-rule:
      • Enhanced prelude parsing for complex queries. Parentheses with errors will be parsed as GeneralEnclosed
      • Added support for features in a range context, e.g. (width > 100px) or (100px < height < 400px)
      • Transitioned from MediaFeature node type to the Feature node type with kind: "media"
      • Changed MediaQuery node structure into the following form:
        type MediaQuery = {
            type: "MediaQuery";
            modifier: string | null; // e.g. "not", "only", etc.
            mediaType: string | null; // e.g. "all", "screen", etc.
            condition: Condition | null;
        }
        
    • Changes for @supports at-rule:
      • Enhanced prelude parsing for complex queries. Parentheses with errors will be parsed as GeneralEnclosed
      • Added support for features in a range context, e.g. (width > 100px) or (100px < height < 400px)
      • Added SupportsDeclaration node type to encapsulate a declaration in a query, replacing Parentheses
      • Parsing now employs Condition or SupportsDeclaration nodes of kind supports instead of Parentheses
      • Added support for the selector() feature via the FeatureFunction node (configured in features.supports.selector)
View originalPermalink
How v3.0.0 went
v2.3.1

2.3.1

Added 1
  • Added :host, :host() and :host-context() pseudo class support
Fixed 1
  • Fixed generator, parse and parse-selector entry points by adding missed NestedSelector node type
Removed 1
  • Removed npm > 7 version requirement

From csstree

  • Added :host, :host() and :host-context() pseudo class support (#216)
  • Fixed generator, parse and parse-selector entry points by adding missed NestedSelector node type
  • Removed npm > 7 version requirement (#218)
View originalPermalink
How v2.3.1 went
v2.3.0

2.3.0 CSS Nesting, units introspection & customisation

Added 3
  • CSS Nesting support with NestingSelector node type for & (nesting selector) in selectors
  • Add @nest at-rule
  • Add Lexer#units dictionary to provide unit groups (length, angle, etc.) used for matching
Changed 5
  • Parse @media inside a Rule to handle block content as Declaration first
  • Update DeclarationList behaviour to follow the rules for Rule's block
  • Lexer constructor now considers config.units to override default units
  • Extended lexer's dump to contain a units dictionary
  • Bumped mdn-data to 2.0.30

From csstree

  • Added CSS Nesting support:
    • Added NestingSelector node type for & (a nesting selector) in selectors
    • Added @nest at-rule
    • Changed behaviour for @media inside a Rule to parse its block content as a Declaration first
    • Changed DeclarationList behaviour to follow the rules for Rule's block
  • Added the dimension units introspection & customisation:
    • Added Lexer#units dictionary to provide unit groups (length, angle, etc.) used for matching
    • Changed Lexer's constructor to take into consideration config.units to override default units
    • Extended lexer's dump to contain a units dictionary
  • Bumped mdn-data to 2.0.30
View originalPermalink
How v2.3.0 went
v2.2.1

2.2.1

Fixed 1
  • Fix regression for at-rule syntax matching when at-rule has no prelude

From csstree

  • Fixed a regression added in 2.2.0 for at-rule syntax matching when at-rule has no prelude (#203)
View originalPermalink
How v2.2.1 went
v2.2.0

2.2.0

Added 5
  • Support for CSS wide keywords revert and revert-layer
  • New units rex, cap, rcap, rch, ic, ric, lh, rlh, vi, vb, sv*, lv*, dv* according to CSS Values and Units 4
  • Container relative length units cqw, cqh, cqi, cqb, cqmin, cqmax from CSS Containment 3
  • Support for stacked multipliers +# and #? in value definition syntax
  • Parsing of a dimension in range definition notations
Changed 4
  • Bumped mdn-data to 2.0.28
  • Patched background-clip property definition to match Backgrounds and Borders 4 specification
  • Patched content property definition to allow attr()
  • Parsing of range definition notation to not omit [-∞,∞] ranges
Fixed 2
  • Definition syntax matching when a comma is expected before a <delim-token>
  • At-rule validation fail when no prelude is specified and its syntax allows an empty prelude, affecting @page at-rule
Removed 2
  • Support for expression() function
  • Unit vm

From csstree

  • Bumped mdn-data to 2.0.28
  • Added support for CSS wide keywords revert and revert-layer
  • Dropped support for expression() the same way as CSS wide keywords
  • Patched background-clip property definition to match Backgrounds and Borders 4 (#190)
  • Patched content property definition to allow attr() (#201)
  • Fixed definition syntax matching when a comma is expected before a <delim-token>
  • Fixed at-rule validation fail when no prelude is specified and its syntax allows an empty prelude, that's the case for @page at-rule (#191)
  • Added new units according to current state of CSS Values and Units 4: rex, cap, rcap, rch, ic, ric, lh, rlh, vi, vb, sv*, lv*, dv*
  • Added container relative length units from CSS Containment 3: cqw, cqh, cqi, cqb, cqmin, cqmax
  • Removed vm unit (supposed to be an old IE versions supported this unit instead of vmax)
  • Value definition syntax:
    • Added support for stacked multipliers +# and #? according to spec (#199)
    • Added parsing of a dimension in range definition notations, however, a validation for such ranges is not supported yet (#192)
    • Changed parsing of range definition notation to not omitting [-∞,∞] ranges
View originalPermalink
How v2.2.0 went
v2.1.0

2.1.0

Added 4
  • Add module field to package.json
  • Add css-tree/convertor export
  • Add css-tree/selector-parser export
  • Add parsing support for :is(), :-moz-any(), :-webkit-any() and :where()
Changed 4
  • Bump mdn-data to 2.0.27
  • Rename syntaxes into types in css-tree/definition-syntax-data-patch
  • Reduce css-tree/parser bundle size from 50kb to 41kb
  • Reduce css-tree/generator bundle size from 46kb to 23kb
Fixed 2
  • Fix minor issues in CommonJS version
  • Fix css-tree/utils export

From csstree

  • Bumped mdn-data to 2.0.27
  • Added module field to package.json
  • Fixed minor issues in CommonJS version
  • Fixed css-tree/utils export (#181)
  • Added css-tree/convertor export
  • Added css-tree/selector-parser export (~27kb when bundled, #183)
  • Reduced bundle size:
    • css-tree/parser 50kb -> 41kb
    • css-tree/generator 46kb -> 23kb
  • Renamed syntaxes into types in css-tree/definition-syntax-data-patch
  • Added parsing support for :is(), :-moz-any(), :-webkit-any() and :where() (#182, #184)
View originalPermalink
How v2.1.0 went
View all

Discussion

If you publish csstree, you can claim this product by proving you administer its repository.