Changelog
1.0.0-alpha.35 (October 7, 2019)
find()
, findLast()
and findAll()
methods (e.g. csstree.find(ast, node => node.type === 'ClassSelector')
)Changelog
1.0.0-alpha.34 (July 27, 2019)
isBOM()
functioncharCodeCategory()
functionfirstCharOffset()
function (use isBOM()
instead)CHARCODE
dictionaryINPUT_STREAM_CODE*
dictionariesdebugger
(#104)Changelog
1.0.0-alpha.33 (July 11, 2019)
Changelog
1.0.0-alpha.32 (July 11, 2019)
||-
and &&-
groups (#103)Changelog
1.0.0-alpha.31 (July 11, 2019)
mdn/data
to 2.0.4
(#99)<number-zero-one>
, <number-one-or-greater>
and <positive-integer>
from generic types. In fact, types moved to patch, because those types can be expressed in a regular grammar due to bracketed range notation implemented<custom-ident>
production matching to claim the keyword only if no other unfulfilled production can claim it (#101)<length>
production matching to claim "unitless zero" only if no other unfulfilled production can claim it||
- and &&
-group matching, matching continues from the beginning on term match (#85)var()
occurrences when value is a string (such values can't be matched on syntax currently and fail with specific error that can be used for ignorance in validation tools)<declaration-value>
and <any-value>
matching when a value contains a function, parentheses or bracesChangelog
1.0.0-alpha.30 (July 3, 2019)
mdn/data
to ~2.0.3
mdn/data
due to lack of some generic types and specific lexer restictions (since lexer was reworked, see below)Tokenizer
class splitted into several abstractions:
TokenStream
classOffsetToLocation
classtokenize()
function that creates TokenStream
instance for given string or updates a TokenStream
instance passed as second parameterTokenizer
classRaw
token typeIdentifier
token type to Ident
Hash
, BadString
, BadUrl
, Delim
, Percentage
, Dimension
, Colon
, Semicolon
, Comma
, LeftSquareBracket
, RightSquareBracket
, LeftParenthesis
, RightParenthesis
, LeftCurlyBracket
, RightCurlyBracket
Punctuator
with Delim
token type, that excludes specific characters with its own token type like Colon
, Semicolon
etcfindCommentEnd
, findStringEnd
, findDecimalNumberEnd
, findNumberEnd
, findEscapeEnd
, findIdentifierEnd
and findUrlRawEnd
helper functionSYMBOL_TYPE
, PUNCTUATION
and STOP_URL_RAW
dictionariesisDigit
, isHexDigit
, isUppercaseLetter
, isLowercaseLetter
, isLetter
, isNonAscii
, isNameStart
, isName
, isNonPrintable
, isNewline
, isWhiteSpace
, isValidEscape
, isIdentifierStart
, isNumberStart
, consumeEscaped
, consumeName
, consumeNumber
and consumeBadUrlRemnants
helper functionsHexColor
consumption in way to relax checking a value, i.e. now value
is a sequence of one or more name chars&
as a property hackvar()
parsing to only check that a first arguments is an identifier (not a custom property name as before)Lexer#match()
, Lexer#matchType()
and Lexer#matchProperty()
methods to take a string as value, beside AST as a valueLexer#match()
method to take a string as a syntax, beside of syntax descriptor<attr()>
, <url>
(moved to patch) and <progid>
types<ident-token>
, <function-token>
, <at-keyword-token>
, <hash-token>
, <string-token>
, <bad-string-token>
, <url-token>
, <bad-url-token>
, <delim-token>
, <number-token>
, <percentage-token>
, <dimension-token>
, <whitespace-token>
, <CDO-token>
, <CDC-token>
, <colon-token>
, <semicolon-token>
, <comma-token>
, <[-token>
, <]-token>
, <(-token>
, <)-token>
, <{-token>
and <}-token>
<an-plus-b>
, <urange>
, <custom-property-name>
, <declaration-value>
, <any-value>
and <zero>
<unicode-range>
to <urange>
as per spec<expression>
(IE legacy extension) to <-ms-legacy-expression>
and may to be removed in next releasesChangelog
1.0.0-alpha.29 (May 30, 2018)
Token
node type to represent a single code point (<delim-token>
)Multiplier
that wraps a single node (term
property)AtKeyword
to represent <at-keyword-token>
Slash
and Percent
node types, they are replaced for a node with Token
typeFunction
to represent <function-token>
with no childrenmultiplier
property from Group
generate()
method:
options
as second argument now (generate(node, forceBraces, decorator)
-> generate(node, options)
). Two options are supported: forceBraces
and decorator
decorate
option value, i.e. generate(node, fn)
-> generate(node, { decorate: fn })
Atrule
const to AtKeyword
Changelog
1.0.0-alpha.28 (February 19, 2018)
lexer.grammar.translate()
method into generate()
<'-webkit-font-smoothing'>
and <'-moz-osx-font-smoothing'>
syntaxes (#75)<'overflow'>
property syntax (#76)mdn-data
to ~1.1.0
and fixed issues with some updated property syntaxesChangelog
1.0.0-alpha.27 (January 14, 2018)
generate()
methods invocation, methods now take a node as a single argument and context (i.e. this
) that have methods: chunk()
, node()
and children()
translate()
to generate()
and changed to take options
argumenttranslateMarkup(ast, enter, leave)
method, use generate(ast, { decorator: (handlers) => { ... }})
insteadtranslateWithSourceMap(ast)
, use generate(ast, { sourceMap: true })
insteadwalk()
to take an options
argument instead of handler, with enter
, leave
, visit
and reverse
options (walk(ast, fn)
is still works and equivalent to walk(ast, { enter: fn })
)walkUp(ast, fn)
, use walk(ast, { leave: fn })
walkRules(ast, fn)
, use walk(ast, { visit: 'Rule', enter: fn })
insteadwalkRulesRight(ast, fn)
, use walk(ast, { visit: 'Rule', reverse: true, enter: fn })
insteadwalkDeclarations(ast, fn)
, use walk(ast, { visit: 'Declaration', enter: fn })
insteadreverse: true
will fail on arrays since they have no forEachRight()
method)List#forEach()
methodList#forEachRight()
methodList#filter()
methodList#map()
method to return a List
instance instead of Array
List#push()
method, similar to List#appendData()
but returns nothingList#pop()
methodList#unshift()
method, similar to List#prependData()
but returns nothingList#shift()
methodList#prependList()
methodList#insert()
, List#insertData()
, List#appendList()
and List#insertList()
methods to return a list that performed an operationkeyword()
method
name
field to include a vendor prefixbasename
field to contain a name without a vendor prefixcustom
field that contain a true
when keyword is a custom property referenceproperty()
method
name
field to include a vendor prefixbasename
field to contain a name without any prefixes, i.e. a hack and a vendor prefixvendorPrefix()
methodisCustomProperty()
methodChangelog
1.0.0-alpha.26 (November 9, 2017)
Tokenizer#isBalanceEdge()
methodTokenizer.endsWith()
methodtolerant
parser option (no parsing modes anymore)property
parser option (a value parsing does not depend on property name anymore)Brackets
, Function
and Parentheses
when EOF is reachedRaw
node)Raw
node, not a declaration as before)Raw
node that represents a declaration valueValue
parse handler to return a node only with type Value
(previously it returned a Raw
node in some cases)onParseError()
is not invoked for errors occured on selector or declaration value parsing in some casesonParseError()
to stop parsing if handler throws an exceptiongrammar.walk()
to invoke passed handler on entering to node rather than on leaving the nodegrammar.walk()
to take a walk handler pair as an object, i.e. walk(node, { enter: fn, leave: fn })
Lexer#match*()
methods to take a node of any type, but with a children
fieldLexer#match(syntax, node)
methodLexer#matchType()
method to stop return a positive result for the CSS wide keywords