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.

537 lines
34 KiB

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