css-tree
Advanced tools
Changelog
2.3.0 (November 30, 2022)
NestingSelector
node type for &
(a nesting selector) in selectors@nest
at-rule@media
inside a Rule
to parse its block content as a Declaration
firstDeclarationList
behaviour to follow the rules for Rule
's blockLexer#units
dictionary to provide unit groups (length
, angle
, etc.) used for matchingconfig.units
to override default unitsmdn-data
to 2.0.30
Changelog
2.2.1 (August 14, 2022)
2.2.0
for at-rule syntax matching when at-rule has no preludeChangelog
2.2.0 (August 10, 2022)
mdn-data
to 2.0.28
revert
and revert-layer
expression()
the same way as CSS wide keywordsbackground-clip
property definition to match Backgrounds and Borders 4 (#190)content
property definition to allow attr()
(#201)<delim-token>
@page
at-rule (#191)rex
, cap
, rcap
, rch
, ic
, ric
, lh
, rlh
, vi
, vb
, sv*
, lv*
, dv*
cqw
, cqh
, cqi
, cqb
, cqmin
, cqmax
vm
unit (supposed to be an old IE versions supported this unit instead of vmax
)+#
and #?
according to spec (#199)[-∞,∞]
rangesChangelog
2.1.0 (February 17, 2022)
mdn-data
to 2.0.27
module
field to package.json
css-tree/utils
export (#181)css-tree/convertor
exportcss-tree/selector-parser
export (~27kb when bundled, #183)css-tree/parser
50kb -> 41kbcss-tree/generator
46kb -> 23kbsyntaxes
into types
in css-tree/definition-syntax-data-patch
:is()
, :-moz-any()
, :-webkit-any()
and :where()
(#182, #184)Changelog
2.0.4 (December 17, 2021)
^10
generate()
in safe mode to add a whitespace between <dimension-token>
and <hash-token>
, otherwise some values are broken in IE11, e.g. border
properties (#173):
for an attribute name on AttributeSelector
parsing as it does not meet the CSS specs (details)Changelog
2.0.3 (December 14, 2021)
generate()
in safe
mode between type-selector
and id-selector
(e.g. a#id
). A regression was introduces in 2.0.2
since IE11 fails on values when <hash-token>
goes after <ident-token>
without a whitespace in the middle, e.g. 1px solid#000
. Thus, in one case, a space between the <ident-token>
and the <hash-token>
is required, and in the other, vice versa. Until a better solution found, a workaround is used on id-selector
generation by producing a <delim-token>
instead of <hash-token>
.Changelog
2.0.2 (December 10, 2021)
width
, min-width
and max-width
syntax definitionsmdn-data
source-map
with source-map-js
which reduce install size by ~700KBcalc()
function consumption on definition syntax matchinggenerate()
auto emitting a whitespace edge cases when next token starts with a dash (minus)generate()
safe mode to cover more cases for IE11dist/data.cjs
and dist/version.cjs
css-tree/definition-syntax-data
css-tree/definition-syntax-data-patch
Changelog
2.0.1 (December 4, 2021)
^12.20.0
and ^14.13.0
versionsChangelog
2.0.0 (December 3, 2021)
^10 || ^12.20.0 || ^14.13.0 || >=15.0.0
)import * as parser from "css-tree/parser"
or require("css-tree/parser")
):
css-tree/tokenizer
css-tree/parser
css-tree/walker
css-tree/generator
css-tree/lexer
css-tree/definition-syntax
css-tree/utils
dist/csstree.js
(an IIFE version with csstree
as a global name) and dist/csstree.esm.js
(as ES module). Both are minifiedmdn-data
to 2.0.23
tokenize()
to take a function as second argument, which will be called for every token. No stream instance is creating when second argument is ommited.TokenStream#getRawLength()
to take second parameter as a function (rule) that check a char code to stop a scanningTokenStream#forEachToken(fn)
methodTokenStream#skipWS()
methodTokenStream#getTokenLength()
methodSyntaxError
(custom parser's error class) from root of public API to parser via parse.SyntaxError
parseError
field in parser's SyntaxError
{ type: 'Combinator', name: ' ' }
node instead of WhiteSpace
nodeWhiteSpace
nodes with the single exception for a custom property declaration with a single white space token as a value+
and -
operators, when a whitespace is before and/or after an operatorparse.config
consumeUntilBalanceEnd()
, consumeUntilLeftCurlyBracket()
, consumeUntilLeftCurlyBracketOrSemicolon()
, consumeUntilExclamationMarkOrSemicolon()
and consumeUntilSemicolonIncluded()
methods to parser's inner API to use with Raw
instead of Raw.mode
Nth
to always consume of
clause when presented, so it became more general and moves validation to lexerString
node type to store decoded string value, i.e. with no quotes and escape sequencesUrl
node type to store decoded url value as a string instead of String
or Raw
node, i.e. with no quotes, escape sequences and url()
wrapperchunk()
handler to token()
(output a single token) and tokenize()
(split a string into tokens and output each of them)mode
option for generate()
to specify a mode of token separation: spec
or safe
(by default)emit(token, type, auto)
handler as implementation specific token processorNth
to serialize +n
as n
string
and url
tokens on serializationLexer#matchDeclaration()
methodident
, string
and url
helpers to decode/encode corresponding values, e.g. url.decode('url("image.jpg")')
=== 'image.jpg'
List
to be iterable (iterates data)List#first
, List#last
and List#isEmpty
to gettersList#getSize()
method to List#size
getterList#each()
and List#eachRight()
methods, List#forEach()
and List#forEachRight()
should be used instead