You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

590 lines
37 KiB

1 month ago
  1. ## 1.1.3 (March 31, 2021)
  2. - Fixed matching on CSS wide keywords for at-rule's prelude and descriptors
  3. - Added `fit-content` to `width` property patch as browsers are supported it as a keyword (nonstandard), but spec defines it as a function
  4. - Fixed parsing a value contains parentheses or brackets and `parseValue` option is set to `false`, in that case `!important` was included into a value but must not (#155)
  5. ## 1.1.2 (November 26, 2020)
  6. - Rolled back to use spread syntax in object literals since it not supported by nodejs < 8.3 (#145)
  7. ## 1.1.1 (November 18, 2020)
  8. - Fixed edge cases in mismatch location computation for `SyntaxMatchError`
  9. ## 1.1.0 (November 17, 2020)
  10. - Bumped `mdn-data` to 2.0.14
  11. - Extended `fork()` method to allow append syntax instead of overriding for `types`, `properties` and `atrules`, e.g. `csstree.fork({ types: { color: '| foo | bar' } })`
  12. - Extended lexer API for validation
  13. - Added `Lexer#checkAtruleName(atruleName)`, `Lexer#checkAtrulePrelude(atruleName, prelude)`, `Lexer#checkAtruleDescriptorName(atruleName, descriptorName)` and `Lexer#checkPropertyName(propertyName)`
  14. - Added `Lexer#getAtrule(atruleName, fallbackBasename)` method
  15. - Extended `Lexer#getAtrulePrelude()` and `Lexer#getProperty()` methods to take `fallbackBasename` parameter
  16. - Improved `SyntaxMatchError` location details
  17. - Changed error messages
  18. ## 1.0.1 (November 11, 2020)
  19. - Fixed edge cases for parsing of custom property value with a single whitespace when `parseCustomProperty:true`
  20. ## 1.0.0 (October 27, 2020)
  21. - Added `onComment` option to parser config
  22. - Added support for `break` and `skip` values in `walk()` to control traversal
  23. - Added `List#reduce()` and `List#reduceRight()` methods
  24. - Bumped `mdn-data` to 2.0.12
  25. - Exposed version of the lib (i.e. `import { version } from 'css-tree'`)
  26. - Fixed `Lexer#dump()` to dump atrules syntaxes as well
  27. - Fixed matching comma separated `<urange>` list (#135)
  28. - Renamed `HexColor` node type into `Hash`
  29. - Removed `element()` specific parsing rules
  30. - Removed `dist/default-syntax.json` from package
  31. ## 1.0.0-alpha.39 (December 5, 2019)
  32. - Fixed walker with `visit: "Declaration"` to iterate `DeclarationList` (#114)
  33. ## 1.0.0-alpha.38 (November 25, 2019)
  34. - Bumped `mdn-data` to `2.0.6`
  35. - Added initial implmentation for at-rule matching via `Lexer#matchAtrulePrelude()` and `Lexer#matchAtruleDescriptor()` methods
  36. - Added `-moz-control-character-visibility`, `-ms-grid-columns`, `-ms-grid-rows` and `-ms-hyphenate-limit-last` properties to patch (#111)
  37. - Added `flow`, `flow-root` and `table-caption` values to patched `display` (#112)
  38. ## 1.0.0-alpha.37 (October 22, 2019)
  39. - Bumped `source-map` version to `^0.6.1` to fix source map generation inconsistency across node.js versions due to mappings sorting bug and v8 moving to [a stable Array#sort](https://v8.dev/blog/array-sort) ([fix commit](https://github.com/mozilla/source-map/commit/f35a2e4212dd025cb5e1fc219e7ac8a4b96c2cc9) in `source-map`)
  40. ## 1.0.0-alpha.36 (October 13, 2019)
  41. - Dropped support for Node < 8
  42. - Updated dev deps (fixed `npm audit` issues)
  43. - Reworked build pipeline
  44. - Package provides `dist/csstree.js` and `dist/csstree.min.js` now (instead of single `dist/csstree.js` that was a min version)
  45. - Bundle size (min version) reduced from 191Kb to 158Kb due to some optimisations
  46. - Definition syntax
  47. - Renamed `grammar` into `definitionSyntax` (named per spec)
  48. - Added `compact` option to `generate()` method to avoid formatting (spaces) when possible
  49. - Lexer
  50. - Changed `dump()` method to produce syntaxes in compact form by default
  51. ## 1.0.0-alpha.35 (October 7, 2019)
  52. - Walker
  53. - Changed implementation to avoid runtime compilation due to CSP issues (see #91, #109)
  54. - Added `find()`, `findLast()` and `findAll()` methods (e.g. `csstree.find(ast, node => node.type === 'ClassSelector')`)
  55. ## 1.0.0-alpha.34 (July 27, 2019)
  56. - Tokenizer
  57. - Added `isBOM()` function
  58. - Added `charCodeCategory()` function
  59. - Removed `firstCharOffset()` function (use `isBOM()` instead)
  60. - Removed `CHARCODE` dictionary
  61. - Removed `INPUT_STREAM_CODE*` dictionaries
  62. - Lexer
  63. - Allowed comments in matching value (just ignore them like whitespaces)
  64. - Increased iteration count in value matching from 10k up to 15k
  65. - Fixed missed `debugger` (#104)
  66. ## 1.0.0-alpha.33 (July 11, 2019)
  67. - Lexer
  68. - Fixed low priority productions matching by changing an approach for robust one (#103)
  69. ## 1.0.0-alpha.32 (July 11, 2019)
  70. - Lexer
  71. - Fixed low priority productions matching in long `||-` and `&&-` groups (#103)
  72. ## 1.0.0-alpha.31 (July 11, 2019)
  73. - Bumped `mdn/data` to `2.0.4` (#99)
  74. - Lexer
  75. - Added [bracketed range notation](https://drafts.csswg.org/css-values-4/#numeric-ranges) support and related refactoring
  76. - Removed `<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
  77. - Added support for multiple token string matching
  78. - Improved `<custom-ident>` production matching to claim the keyword only if no other unfulfilled production can claim it (#101)
  79. - Improved `<length>` production matching to claim "unitless zero" only if no other unfulfilled production can claim it
  80. - Changed lexer's constructor to prevent generic types override when used
  81. - Fixed large `||`- and `&&`-group matching, matching continues from the beginning on term match (#85)
  82. - Fixed checking that value has `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)
  83. - Fixed `<declaration-value>` and `<any-value>` matching when a value contains a function, parentheses or braces
  84. ## 1.0.0-alpha.30 (July 3, 2019)
  85. - Bumped `mdn/data` to `~2.0.3`
  86. - Removed type removals from `mdn/data` due to lack of some generic types and specific lexer restictions (since lexer was reworked, see below)
  87. - Reduced and updated patches
  88. - Tokenizer
  89. - Reworked tokenizer itself to compliment [CSS Syntax Module Level 3](https://drafts.csswg.org/css-syntax/#tokenization)
  90. - `Tokenizer` class splitted into several abstractions:
  91. - Added `TokenStream` class
  92. - Added `OffsetToLocation` class
  93. - Added `tokenize()` function that creates `TokenStream` instance for given string or updates a `TokenStream` instance passed as second parameter
  94. - Removed `Tokenizer` class
  95. - Removed `Raw` token type
  96. - Renamed `Identifier` token type to `Ident`
  97. - Added token types: `Hash`, `BadString`, `BadUrl`, `Delim`, `Percentage`, `Dimension`, `Colon`, `Semicolon`, `Comma`, `LeftSquareBracket`, `RightSquareBracket`, `LeftParenthesis`, `RightParenthesis`, `LeftCurlyBracket`, `RightCurlyBracket`
  98. - Replaced `Punctuator` with `Delim` token type, that excludes specific characters with its own token type like `Colon`, `Semicolon` etc
  99. - Removed `findCommentEnd`, `findStringEnd`, `findDecimalNumberEnd`, `findNumberEnd`, `findEscapeEnd`, `findIdentifierEnd` and `findUrlRawEnd` helper function
  100. - Removed `SYMBOL_TYPE`, `PUNCTUATION` and `STOP_URL_RAW` dictionaries
  101. - Added `isDigit`, `isHexDigit`, `isUppercaseLetter`, `isLowercaseLetter`, `isLetter`, `isNonAscii`, `isNameStart`, `isName`, `isNonPrintable`, `isNewline`, `isWhiteSpace`, `isValidEscape`, `isIdentifierStart`, `isNumberStart`, `consumeEscaped`, `consumeName`, `consumeNumber` and `consumeBadUrlRemnants` helper functions
  102. - Parser
  103. - Changed parsing algorithms to work with new token type set
  104. - Changed `HexColor` consumption in way to relax checking a value, i.e. now `value` is a sequence of one or more name chars
  105. - Added `&` as a property hack
  106. - Relaxed `var()` parsing to only check that a first arguments is an identifier (not a custom property name as before)
  107. - Lexer
  108. - Reworked syntax matching to relay on token set only (having AST is optional now)
  109. - Extended `Lexer#match()`, `Lexer#matchType()` and `Lexer#matchProperty()` methods to take a string as value, beside AST as a value
  110. - Extended `Lexer#match()` method to take a string as a syntax, beside of syntax descriptor
  111. - Reworked generic types:
  112. - Removed `<attr()>`, `<url>` (moved to patch) and `<progid>` types
  113. - Added types:
  114. - Related to token 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>`
  115. - Complex types: `<an-plus-b>`, `<urange>`, `<custom-property-name>`, `<declaration-value>`, `<any-value>` and `<zero>`
  116. - Renamed `<unicode-range>` to `<urange>` as per spec
  117. - Renamed `<expression>` (IE legacy extension) to `<-ms-legacy-expression>` and may to be removed in next releases
  118. ## 1.0.0-alpha.29 (May 30, 2018)
  119. - Lexer
  120. - Syntax matching was completely reworked. Now it's token-based and uses state machine. Public API has not changed. However, some internal data structures have changed. Most significal change in syntax match result tree structure, it's became token-based instead of node-based.
  121. - Grammar
  122. - Changed grammar tree format:
  123. - Added `Token` node type to represent a single code point (`<delim-token>`)
  124. - Added `Multiplier` that wraps a single node (`term` property)
  125. - Added `AtKeyword` to represent `<at-keyword-token>`
  126. - Removed `Slash` and `Percent` node types, they are replaced for a node with `Token` type
  127. - Changed `Function` to represent `<function-token>` with no children
  128. - Removed `multiplier` property from `Group`
  129. - Changed `generate()` method:
  130. - Method takes an `options` as second argument now (`generate(node, forceBraces, decorator)` -> `generate(node, options)`). Two options are supported: `forceBraces` and `decorator`
  131. - When a second parameter is a function it treats as `decorate` option value, i.e. `generate(node, fn)` -> `generate(node, { decorate: fn })`
  132. - Decorate function invokes with additional parameter – a reference to a node
  133. - Tokenizer
  134. - Renamed `Atrule` const to `AtKeyword`
  135. ## 1.0.0-alpha.28 (February 19, 2018)
  136. - Renamed `lexer.grammar.translate()` method into `generate()`
  137. - Fixed `<'-webkit-font-smoothing'>` and `<'-moz-osx-font-smoothing'>` syntaxes (#75)
  138. - Added vendor keywords for `<'overflow'>` property syntax (#76)
  139. - Pinned `mdn-data` to `~1.1.0` and fixed issues with some updated property syntaxes
  140. ## 1.0.0-alpha.27 (January 14, 2018)
  141. - Generator
  142. - Changed node's `generate()` methods invocation, methods now take a node as a single argument and context (i.e. `this`) that have methods: `chunk()`, `node()` and `children()`
  143. - Renamed `translate()` to `generate()` and changed to take `options` argument
  144. - Removed `translateMarkup(ast, enter, leave)` method, use `generate(ast, { decorator: (handlers) => { ... }})` instead
  145. - Removed `translateWithSourceMap(ast)`, use `generate(ast, { sourceMap: true })` instead
  146. - Changed to support for children as an array
  147. - Walker
  148. - Changed `walk()` 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 })`)
  149. - Removed `walkUp(ast, fn)`, use `walk(ast, { leave: fn })`
  150. - Removed `walkRules(ast, fn)`, use `walk(ast, { visit: 'Rule', enter: fn })` instead
  151. - Removed `walkRulesRight(ast, fn)`, use `walk(ast, { visit: 'Rule', reverse: true, enter: fn })` instead
  152. - Removed `walkDeclarations(ast, fn)`, use `walk(ast, { visit: 'Declaration', enter: fn })` instead
  153. - Changed to support for children as array in most cases (`reverse: true` will fail on arrays since they have no `forEachRight()` method)
  154. - Misc
  155. - List
  156. - Added `List#forEach()` method
  157. - Added `List#forEachRight()` method
  158. - Added `List#filter()` method
  159. - Changed `List#map()` method to return a `List` instance instead of `Array`
  160. - Added `List#push()` method, similar to `List#appendData()` but returns nothing
  161. - Added `List#pop()` method
  162. - Added `List#unshift()` method, similar to `List#prependData()` but returns nothing
  163. - Added `List#shift()` method
  164. - Added `List#prependList()` method
  165. - Changed `List#insert()`, `List#insertData()`, `List#appendList()` and `List#insertList()` methods to return a list that performed an operation
  166. - Changed `keyword()` method
  167. - Changed `name` field to include a vendor prefix
  168. - Added `basename` field to contain a name without a vendor prefix
  169. - Added `custom` field that contain a `true` when keyword is a custom property reference
  170. - Changed `property()` method
  171. - Changed `name` field to include a vendor prefix
  172. - Added `basename` field to contain a name without any prefixes, i.e. a hack and a vendor prefix
  173. - Added `vendorPrefix()` method
  174. - Added `isCustomProperty()` method
  175. ## 1.0.0-alpha.26 (November 9, 2017)
  176. - Tokenizer
  177. - Added `Tokenizer#isBalanceEdge()` method
  178. - Removed `Tokenizer.endsWith()` method
  179. - Parser
  180. - Made the parser tolerant to errors by default
  181. - Removed `tolerant` parser option (no parsing modes anymore)
  182. - Removed `property` parser option (a value parsing does not depend on property name anymore)
  183. - Canceled error for a handing semicolon in a block
  184. - Canceled error for unclosed `Brackets`, `Function` and `Parentheses` when EOF is reached
  185. - Fixed error when prelude ends with a comment for at-rules with custom prelude consumer
  186. - Relaxed at-rule parsing:
  187. - Canceled error when EOF is reached after a prelude
  188. - Canceled error for an at-rule with custom block consumer when at-rule has no block (just don't apply consumer in that case)
  189. - Canceled error on at-rule parsing when it occurs outside prelude or block (at-rule is converting to `Raw` node)
  190. - Allowed for any at-rule to have a prelude and a block, even if it's invalid per at-rule syntax (the responsibility for this check is moved to lexer, since it's possible to construct a AST with such errors)
  191. - Made a declaration value a safe parsing point (i.e. error on value parsing lead to a value is turning into `Raw` node, not a declaration as before)
  192. - Excluded surrounding white spaces and comments from a `Raw` node that represents a declaration value
  193. - Changed `Value` parse handler to return a node only with type `Value` (previously it returned a `Raw` node in some cases)
  194. - Fixed issue with `onParseError()` is not invoked for errors occured on selector or declaration value parsing in some cases
  195. - Changed using of `onParseError()` to stop parsing if handler throws an exception
  196. - Lexer
  197. - Changed `grammar.walk()` to invoke passed handler on entering to node rather than on leaving the node
  198. - Improved `grammar.walk()` to take a walk handler pair as an object, i.e. `walk(node, { enter: fn, leave: fn })`
  199. - Changed `Lexer#match*()` methods to take a node of any type, but with a `children` field
  200. - Added `Lexer#match(syntax, node)` method
  201. - Fixed `Lexer#matchType()` method to stop return a positive result for the CSS wide keywords
  202. ## 1.0.0-alpha25 (October 9, 2017)
  203. - Parser
  204. - Added fallback node as argument to `onParseError()` handler
  205. - Fixed raw consuming in tolerant mode when selector is invalid (greedy consuming and redundant warnings)
  206. - Fixed exception in tolerant mode caused by unknown at-rule with unclosed block
  207. - Changed handling of semicolons:
  208. - Hanging semicolon inside declaration blocks raise an error or turns into a `Raw` node in tolerant mode instead of being ignored
  209. - Semicolon outside of declaration blocks opens a `Rule` node as part of selector instead of being ignored
  210. - Aligned `parseAtrulePrelude` behaviour to `parseRulePrelude`
  211. - Removed `Raw` node wraping into `AtrulePrelude` when `parseAtrulePrelude` is disabled
  212. - Removed error emitting when at-rule has a custom prelude customer but no prelude is found (it should be validated by a lexer later)
  213. - Generator
  214. - Fixed performance issue with `translateWithSourceMap()`, flattening the string (because of mixing building string and indexing into it) turned it into a quadratic algorithm (approximate numbers can be found in [the quiz created by this case](https://gist.github.com/lahmatiy/ea25d0e623d88ca9848384b5707d52d9))
  215. - Added support for a single solidus hack for `property()`
  216. - Minor fixes for custom errors
  217. ## 1.0.0-alpha24 (September 14, 2017)
  218. - Improved CSSTree to be stable for standart build-in objects extension (#58)
  219. - Parser
  220. - Renamed rule's `selector` to `prelude`. The reasons: [spec names this part so](https://www.w3.org/TR/css-syntax-3/#qualified-rule), and this branch can contain not only a selector (`SelectorList`) but also a raw payload (`Raw`). What's changed:
  221. - Renamed `Rule.selector` to `Rule.prelude`
  222. - Renamed `parseSelector` parser option to `parseRulePrelude`
  223. - Removed option for selector parse in `SelectorList`
  224. - Lexer
  225. - Fixed undefined positions in a error when match a syntax to empty or white space only value
  226. - Improved `Lexer#checkStructure()`
  227. - Return a warning as an object with node reference and message
  228. - No exception on unknown node type, return a warning instead
  229. ## 1.0.0-alpha23 (September 10, 2017)
  230. - Fixed `Tokenizer#getRawLength()`'s false positive balance match to the end of input in some cases (#56)
  231. - Rename walker's entry point methods to be the same as CSSTree exposed methods (i.e. `walk()`, `walkUp()` etc)
  232. - Rename at-rule's `expression` to `prelude` (since [spec names it so](https://www.w3.org/TR/css-syntax-3/#at-rule))
  233. - `AtruleExpression` node type → `AtrulePrelude`
  234. - `Atrule.expression` field → `Atrule.prelude`
  235. - `parseAtruleExpression` parser's option → `parseAtrulePrelude`
  236. - `atruleExpression` parse context → `atrulePrelude`
  237. - `atruleExpression` walk context reference → `atrulePrelude`
  238. ## 1.0.0-alpha22 (September 8, 2017)
  239. - Parser
  240. - Fixed exception on parsing of unclosed `{}-block` in tolerant mode
  241. - Added tolerant mode support for `DeclarationList`
  242. - Added standalone entry point, i.e. default parser can be used via `require('css-tree/lib/parser')` (#47)
  243. - Generator
  244. - Changed generator to produce `+n` when `AnPlusB.a` is `+1` to be "round-trip" with parser
  245. - Added standalone entry point, i.e. default generators can be used via `require('css-tree/lib/generator')`
  246. - Walker
  247. - Added standalone entry point, i.e. default walkers can be used via `require('css-tree/lib/walker')` (#47)
  248. - Lexer
  249. - Added `default` keyword to the list of invalid values for `<custom-ident>` (since it reversed per [spec](https://www.w3.org/TR/css-values/#custom-idents))
  250. - Convertors (`toPlainObject()` and `fromPlainObject()`) moved to `lib/convertor` (entry point is `require('css-tree/lib/convertor')`)
  251. ## 1.0.0-alpha21 (September 5, 2017)
  252. - Tokenizer
  253. - Added `Raw` token type
  254. - Improved tokenization of `url()` with raw as url to be more spec complient
  255. - Added `Tokenizer#balance` array computation on token layout
  256. - Added `Tokenizer#getRawLength()` to compute a raw length with respect of block balance
  257. - Added `Tokenizer#getTokenStart(offset)` method to get token start offset by token index
  258. - Added `idx` and `balance` fields to each token of `Tokenizer#dump()` method result
  259. - Parser
  260. - Added `onParseError` option
  261. - Reworked node parsers that consume a `Raw` node to use a new approach. Since now a `Raw` node builds in `parser#Raw()` function only
  262. - Changed semantic of `parser#Raw()`, it takes 5 parameters now (it might to be changed in future)
  263. - Changed `parser#tolerantParse()` to pass a start token index to fallback function instead of source offset
  264. - Fixed `AtruleExpression` consuming in tolerant mode
  265. - Atrule handler to convert an empty `AtruleExpression` node into `null`
  266. - Changed `AtruleExpression` handler to always return a node (before it could return a `null` in some cases)
  267. - Lexer
  268. - Fixed comma match node for `#` multiplier
  269. - Added reference name to `SyntaxReferenceError`
  270. - Additional fixes on custom errors
  271. - Reduced possible corruption of base config by `syntax.fork()`
  272. ## 1.0.0-alpha20 (August 28, 2017)
  273. - Tokenizer
  274. - Added `Atrule` token type (`<at-rule-token>` per spec)
  275. - Added `Function` token type (`<function-token>` per spec)
  276. - Added `Url` token type
  277. - Replaced `Tokenizer#getTypes()` method with `Tokenizer#dump()` to get all tokens as an array
  278. - Renamed `Tokenizer.TYPE.Whitespace` to `Tokenizer.TYPE.WhiteSpace`
  279. - Renamed `Tokenizer.findWhitespaceEnd()` to `Tokenizer.findWhiteSpaceEnd()`
  280. - Parser
  281. - Added initial implementation of tollerant mode (turn on by passing `tolerant: true` option). In this mode parse errors are never occour and any invalid part of CSS turns into a `Raw` node. Current safe points: `Atrule`, `AtruleExpression`, `Rule`, `Selector` and `Declaration`. Feature is experimental and further improvements are planned.
  282. - Changed `Atrule.expression` to contain a `AtruleExpression` node or `null` only (other node types is wrapping into a `AtruleExpression` node)
  283. - Renamed `AttributeSelector.operator` to `AttributeSelector.matcher`
  284. - Generator
  285. - `translate()` method is now can take a function as second argument, that recieves every generated chunk. When no function is passed, default handler is used, it concats all the chunks and method returns a string.
  286. - Lexer
  287. - Used [mdn/data](https://github.com/mdn/data) package as source of lexer's grammar instead of local dictionaries
  288. - Added `x` unit to `<resolution>` generic type
  289. - Improved match tree:
  290. - Omited Group (sequences) match nodes
  291. - Omited empty match nodes (for terms with `zero or more` multipliers)
  292. - Added `ASTNode` node type to contain a reference to AST node
  293. - Fixed node duplication (uncompleted match were added to tree)
  294. - Added AST node reference in match nodes
  295. - Added comma match node by `#` multiplier
  296. - Grammar
  297. - Changed `translate()` function to get a handler as third argument (optional). That handler recieves result of node traslation and can be used for decoration purposes. See [example](https://github.com/csstree/docs/blob/04c65af44477b5ea05feb373482898122b2a4528/docs/syntax.html#L619-L627)
  298. - Added `SyntaxParseError` to grammar export
  299. - Reworked group and multipliers representation in syntax tree:
  300. - Replaced `Sequence` for `Group` node type (`Sequence` node type removed)
  301. - Added `explicit` boolean property for `Group`
  302. - Only groups can have a multiplier now (other node types is wrapping into a single term implicit group when multiplier is applied)
  303. - Renamed `nonEmpty` Group's property to `disallowEmpty`
  304. - Added optimisation for syntax tree by dropping redundant root `Group` when it contains a single `Group` term (return this `Group` as a result)
  305. - Changed lexer's match functionality
  306. - Changed `Lexer#matchProperty()` and `Lexer#matchType()` to return an object instead of match tree. A match tree stores in `matched` field when AST is matched to grammar successfully, otherwise an error in `error` field. The result object also has some methods to test AST node against a match tree: `getTrace()`, `isType()`, `isProperty()` and `isKeyword()`
  307. - Added `Lexer#matchDeclaration()` method
  308. - Removed `Lexer#lastMatchError` (error stores in match result object in `error` field)
  309. - Added initial implementation of search for AST segments (new lexer methods: `Lexer#findValueSegments()`, `Lexer#findDeclarationValueSegments()` and `Lexer#findAllSegments`)
  310. - Implemented `SyntaxReferenceError` for unknown property and type references
  311. - Renamed field in resulting object of `property()` function: `variable``custom`
  312. - Fixed issue with readonly properties (e.g. `line` and `column`) of `Error` and exception on attempt to write in iOS Safari
  313. ## 1.0.0-alpha19 (April 24, 2017)
  314. - Extended `List` class with new methods:
  315. - `List#prepend(item)`
  316. - `List#prependData(data)`
  317. - `List#insertData(data)`
  318. - `List#insertList(list)`
  319. - `List#replace(item, itemOrList)`
  320. ## 1.0.0-alpha18 (April 3, 2017)
  321. - Added `atrule` walk context (#39)
  322. - Changed a result of generate method for `AnPlusB`, `AttributeSelector`, `Function`, `MediaFeature` and `Ratio` ([1e95877](https://github.com/csstree/csstree/commit/1e9587710efa8e9338bcf0bc794b4b45f286231d))
  323. - Fixed typo in `List` exception messages (@strarsis, #42)
  324. - Improved tokenizer to convert an input to a string
  325. ## 1.0.0-alpha17 (March 13, 2017)
  326. - Implemented new concept of `syntax`
  327. - Changed main `exports` to expose a default syntax
  328. - Defined initial [CSS syntax](lib/syntax/default.js)
  329. - Implemented `createSyntax()` method to create a new syntax from scratch
  330. - Implemented `fork()` method to create a new syntax based on given via extension
  331. - Parser
  332. - Implemented `mediaQueryList` and `mediaQuery` parsing contexts
  333. - Implemented `CDO` and `CDC` node types
  334. - Implemented additional declaration property prefix hacks (`#` and `+`)
  335. - Added support for UTF-16LE BOM
  336. - Added support for `@font-face` at-rule
  337. - Added `chroma()` to legacy IE filter functions
  338. - Improved `HexColor` to consume hex only
  339. - Improved support for `\0` and `\9` hacks (#2)
  340. - Relaxed number check for `Ratio` terms
  341. - Allowed fractal values as a `Ratio` term
  342. - Disallowed zero number as a `Ratio` term
  343. - Changed important clause parsing
  344. - Allowed any identifier for important (to support hacks like `!ie`)
  345. - Store `true` for `important` field in case identifier equals to `important` and string otherwise
  346. - Fixed parse error formatted message rendering to take into account tabs
  347. - Removed exposing of `Parser` class
  348. - Removed `readSelectorSequence()`, `readSequenceFallback()` and `readSelectorSequenceFallback` methods
  349. - Used single universal sequence consumer for `AtruleExpression`, `Selector` and `Value`
  350. - Generator
  351. - Reworked generator to use auto-generated functions based on syntax definition (additional work to be done in next releases)
  352. - Implemented `translateMarkup(ast, before, after)` method for complex cases
  353. - Reworked `translateWithSourceMap` to be more flexible (based on `translateMarkup`, additional work to be done in next releases)
  354. - Walker
  355. - Reworked walker to use auto-generated function based on syntax definition (additional work to be done in next releases)
  356. - Lexer
  357. - Prepared for better extensibility (additional work to be done in next releases)
  358. - Implemented `checkStructure(ast)` method to check AST structure based on syntax definition
  359. - Update syntax dictionaries to latest `mdn/data`
  360. - Add missing `<'offset-position'>` syntax
  361. - Extended `<position>` property with `-webkit-sticky` (@sergejmueller, #37)
  362. - Improved mismatch error position
  363. - Implemented script (`gen:syntax`) to generate AST format reference page (`docs/ast.md`) using syntax definition
  364. ## 1.0.0-alpha16 (February 12, 2017)
  365. - Exposed `Parser` class
  366. - Added `startOffset` option to `Tokenizer` (constructor and `setSource()` method)
  367. - Added fallback functions for default (`readSequenceFallback`) and selector (`readSelectorSequenceFallback`) sequence readers
  368. - Fixed edge cases for `AnPlusB`
  369. - Fixed wrong whitespace ignoring in `Selector` consumer
  370. ## 1.0.0-alpha15 (February 8, 2017)
  371. - Fixed broken `atruleExpression` context
  372. - Fixed vendor prefix detection in `keyword()` and `property()`
  373. - Fixed `property()` to not lowercase custom property names
  374. - Added `variable` boolean flag in `property()` result
  375. - Renamed `scanner` into `tokenizer`
  376. - Ranamed `syntax` into `lexer`
  377. - Moved `docs/*.html` files to [csstree/docs](https://github.com/csstree/docs) repo
  378. - Added `element()` function for `Value` context (`-moz-element()` supported as well)
  379. - Merged `Universal` node type into `Type`
  380. - Renamed node types:
  381. - `Id` -> `IdSelector`
  382. - `Class` -> `ClassSelector`
  383. - `Type` -> `TypeSelector`
  384. - `Attribute` -> `AttributeSelector`
  385. - `PseudoClass` -> `PseudoClassSelector`
  386. - `PseudoElement` -> `PseudoElementSelector`
  387. - `Hash` -> `HexColor`
  388. - `Space` -> `WhiteSpace`
  389. - `An+B` -> `AnPlusB`
  390. - Removed `Progid` node type
  391. - Relaxed `MediaQuery` consumer to not validate syntax on parse and to include whitespaces in children sequence as is
  392. - Added `WhiteSpace.value` property to store whitespace sequence
  393. - Implemented parser options to specify what should be parsed in details (when option is `false` some part of CSS represents as balanced `Raw`):
  394. - `parseAtruleExpression` – to parse at-rule expressions (`true` by default)
  395. - `parseSelector` – to parse rule's selector (`true` by default)
  396. - `parseValue` - to parse declaration's value (`true` by default)
  397. - `parseCustomProperty` – to parse value and fallback of custom property (`false` by default)
  398. - Changed tokenization to stick leading hyphen minus to identifier token
  399. - Changed selector parsing:
  400. - Don't convert spaces into descendant combinator
  401. - Don't validate selector structure on parsing (selectors may be checked by lexer later)
  402. - Initial refactoring of [docs](https://github.com/csstree/csstree/blob/master/docs)
  403. - Various improvements and fixes
  404. ## 1.0.0-alpha14 (February 3, 2017)
  405. - Implemented `DeclarationList`, `MediaQueryList`, `MediaQuery`, `MediaFeature` and `Ratio` node types
  406. - Implemented `declarationList` context (useful to parse HTML `style` attribute content)
  407. - Implemented custom consumers for `@import`, `@media`, `@page` and `@supports` at-rules
  408. - Implemented `atrule` option for `parse()` config, is used for `atruleExpession` context to specify custom consumer for at-rule if any
  409. - Added `Scanner#skipWS()`, `Scanner#eatNonWS()`, `Scanner#consume()` and `Scanner#consumeNonWS()` helper methods
  410. - Added custom consumers for known functional-pseudos, consume unknown functional-pseudo content as balanced `Raw`
  411. - Allowed any `PseudoElement` to be a functional-pseudo (#33)
  412. - Improved walker implementations to reduce GC thrashing by reusing cursors
  413. - Changed `Atrule.block` to contain a `Block` node type only if any
  414. - Changed `Block.loc` positions to include curly brackets
  415. - Changed `Atrule.expression` to store a `null` if no expression
  416. - Changed parser to use `StyleSheet` node type only for top level node (when context is `stylesheet`, that's by default)
  417. - Changed `Parentheses`, `Brackets` and `Function` consumers to use passed sequence reader instead of its own
  418. - Changed `Value` and `AtruleExpression` consumers to use common sequence reader (that reader was used by `Value` consumer before)
  419. - Changed default sequence reader to exclude storage of spaces around `Comma`
  420. - Changed processing of custom properties:
  421. - Consume declaration value as balanced `Raw`
  422. - Consume `var()` fallback value as balanced `Raw`
  423. - Validate first argument of `var()` starts with double dash
  424. - Custom property's value and fallback includes spaces around
  425. - Fixed `Nth` to have a `loc` property
  426. - Fixed `SelectorList.loc` and `Selector.loc` positions to exclude spaces
  427. - Fixed issue Browserify build fail with `default-syntax.json` is not found error (#32, @philschatz)
  428. - Disallowed `Type` selector starting with dash (parser throws an error in this case now)
  429. - Disallowed empty selectors for `Rule` (not sure if it's correct but looks reasonable)
  430. - Removed `>>` combinator support until any browser support (no signals about that yet)
  431. - Removed `PseudoElement.legacy` property
  432. - Removed special case for `:before`, `:after`, `:first-letter` and `:first-line` to represent them as `PseudoElement`, now those pseudos are represented as `PseudoClass` nodes
  433. - Removed deprecated `Syntax#match()` method
  434. - Parser was splitted into modules and related changes, one step closer to an extensible parser
  435. - Various fixes and improvements, all changes have negligible impact on performance
  436. ## 1.0.0-alpha13 (January 19, 2017)
  437. - Changed location storing in `SyntaxMatchError`
  438. - Changed property to store mismatch offset to `mismatchOffset`
  439. - Changed `offset` property to store bad node offset in source CSS if any
  440. - Added `loc` property that stores bad node `loc` if any
  441. ## 1.0.0-alpha12 (January 19, 2017)
  442. - Fixed `Syntax#matchProperty()` method to always return a positive result for custom properties since syntax is never defined for them (#31)
  443. - Implemented `fromPlainObject()` and `toPlainObject()` to convert plain object to AST or AST to plain object (currently converts `List` <-> `Array`)
  444. ## 1.0.0-alpha11 (January 18, 2017)
  445. - Added support for `:matches(<selector-list>)` (#28)
  446. - Added support for `:has(<relative-selector-list>)`
  447. - Added support for `::slotted(<compound-selector>)`
  448. - Implemented `Brackets` node type
  449. - Implemented basic support for at-rule inside rule block (#24)
  450. - Renamed `Selector` node type to `SelectorList`
  451. - Renamed `SimpleSelector` node type to `Selector`
  452. - Renamed `UnicodeRange.name` property to `UnicodeRange.value`
  453. - Replaced `Negation` node type for regular `PseudoClass`
  454. - Unified name of node property to store nested nodes, it always `children` now:
  455. - `StyleSheet.rules` -> `StyleSheet.children`
  456. - `SelectorList.selectors` -> `SelectorList.children`
  457. - `Block.declarations` -> `Block.children`
  458. - `*.sequence` -> `*.children`
  459. - Fixed edge cases in parsing `Hex` and `UnicodeRange` when number not an integer
  460. - Changed `nth-` pseudos parsing
  461. - Implemented `An+B` node type to represent expressions like `2n + 1` or `-3n`
  462. - Fixed edge cases when `a` or `b` is not an integer
  463. - Changed `odd` and `even` keywords processing, keywords are storing as `Identifier` node type now
  464. - Changed `Nth` node type format to store a `nth`-query and an optional `selector`
  465. - Implemented `of` clause for `nth-` pseudos (a.e. `:nth-child(2n + 1 of li, img)`)
  466. - Limited `Nth` parsing rules to `:nth-child()`, `:nth-last-child()`, `:nth-of-type()` and `:nth-last-of-type()` pseudos
  467. - Changed the way to store locations
  468. - Renamed `info` node property to `loc`
  469. - Changed format of `loc` to store `start` and `end` positions
  470. ## 1.0.0-alpha10 (January 11, 2017)
  471. - Reworked `Scanner` to be a single point to its functionality
  472. - Exposed `Scanner` class to be useful for external projects
  473. - Changed `walk()` function behaviour to traverse AST nodes in natural order
  474. - Implemented `walkUp()` function to traverse AST nodes from deepest to parent (behaves as `walk()` before)
  475. ## 1.0.0-alpha9 (December 21, 2016)
  476. - Fixed `<angle>` generic according to specs that allow a `<number>` equals to zero to be used as valid value (#30)
  477. ## 1.0.0-alpha8 (November 11, 2016)
  478. - Fixed `Scanner#skip()` issue method when cursor is moving to the end of source
  479. - Simplified `Progid` node
  480. - Changed behaviour for bad selector processing, now parsing fails instead of selector ignoring
  481. - Fixed `<id-selector>` generic syntax
  482. - Added `q` unit for `<length>` generic syntax
  483. - Refactored syntax parser (performance)
  484. - Reduced startup time by implementing lazy syntax parsing (default syntax doesn't parse on module load)
  485. - Updated syntax dictionaries and used [`mdn/data`](https://github.com/mdn/data) instead of `Template:CSSData`
  486. - Renamed `syntax.stringify()` method to `syntax.translate()`
  487. - Simplified generic syntax functions, those functions receive a single AST node for checking and should return `true` or `false`
  488. - Added exception for values that contains `var()`, those values are always valid for now
  489. - Added more tests and increase code coverage to `98.5%`
  490. ## 1.0.0-alpha7 (October 7, 2016)
  491. - Added support for explicit descendant combinator (`>>`)
  492. - Implemented `Type` and `Universal` type nodes
  493. - Improved `Number` parsing by including sign and exponent (#26)
  494. - Parse `before`, `after`, `first-letter` and `first-line` pseudos with single colon as `PseudoElement`
  495. - Changed `FunctionalPseudo` node type to `PseudoClass`
  496. - Fixed attribute selector name parsing (namespace edge cases)
  497. - Fixed location calculation for specified offset when `eof` is reached
  498. - Added more non-standard colors (#25)
  499. - Removed obsolete `Syntax#getAll()` method
  500. - Fixed various edge cases, code clean up and performance improvements
  501. ## 1.0.0-alpha6 (September 23, 2016)
  502. - More accurate positions for syntax mismatch errors
  503. - Added [`apple`](https://webkit.org/blog/3709/using-the-system-font-in-web-content/) specific font keywords (#20)
  504. - Changed `Property` node stucture from object to string
  505. - Renamed `Ruleset` node type to `Rule`
  506. - Removed `Argument` node type
  507. - Fixed `Dimension` and `Percentage` position computation
  508. - Fixed bad selector parsing (temporary solution)
  509. - Fixed location computation for CSS with very long lines that may lead to really long parsing with `positions:true` (even freeze)
  510. - Fixed `line` and `column` computation for `SyntaxMatch` error
  511. - Improved performance of parsing and translation. Now CSSTree is under 10ms in [PostCSS benchmark](https://github.com/postcss/benchmark).