22 KiB
22 KiB
1.0.0-alpha25 (October 9, 2017)
- Parser
- Added fallback node as argument to
onParseError()handler - Fixed raw consuming in tolerant mode when selector is invalid (greedy consuming and redundant warnings)
- Fixed exception in tolerant mode caused by unknown at-rule with unclosed block
- Changed handling of semicolons:
- Hanging semicolon inside declaration blocks turns into a
Rawnode instead of being ignored - Semicolon outside of declaration blocks opens a
Rulenode as part of selector instead of being ignored
- Hanging semicolon inside declaration blocks turns into a
- Aligned
parseAtrulePreludebehaviour toparseRulePrelude- Removed
Rawnode wraping intoAtrulePreludewhenparseAtrulePreludeis disabled - Removed error emitting when at-rule has a custom prelude customer but no prelude is found (it should be validated by a lexer later)
- Removed
- Added fallback node as argument to
- Generator
- 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)
- Fixed performance issue with
- Added support for a single solidus hack for
property() - Minor fixes for custom errors
1.0.0-alpha24 (September 14, 2017)
- Improved CSSTree to be stable for standart build-in objects extension (#58)
- Parser
- Renamed rule's
selectortoprelude. The reasons: spec names this part so, and this branch can contain not only a selector (SelectorList) but also a raw payload (Raw). What's changed:- Renamed
Rule.selectortoRule.prelude - Renamed
parseSelectorparser option toparseRulePrelude - Removed option for selector parse in
SelectorList
- Renamed
- Renamed rule's
- Lexer
- Fixed undefined positions in a error when match a syntax to empty or white space only value
- Improved
Lexer#checkStructure()- Return a warning as an object with node reference and message
- No exception on unknown node type, return a warning instead
1.0.0-alpha23 (September 10, 2017)
- Fixed
Tokenizer#getRawLength()'s false positive balance match to the end of input in some cases (#56) - Rename walker's entry point methods to be the same as CSSTree exposed methods (i.e.
walk(),walkUp()etc) - Rename at-rule's
expressiontoprelude(since spec names it so)AtruleExpressionnode type →AtrulePreludeAtrule.expressionfield →Atrule.preludeparseAtruleExpressionparser's option →parseAtrulePreludeatruleExpressionparse context →atrulePreludeatruleExpressionwalk context reference →atrulePrelude
1.0.0-alpha22 (September 8, 2017)
- Parser
- Fixed exception on parsing of unclosed
{}-blockin tolerant mode - Added tolerant mode support for
DeclarationList - Added standalone entry point, i.e. default parser can be used via
require('css-tree/lib/parser')(#47)
- Fixed exception on parsing of unclosed
- Generator
- Changed generator to produce
+nwhenAnPlusB.ais+1to be "round-trip" with parser - Added standalone entry point, i.e. default generators can be used via
require('css-tree/lib/generator')
- Changed generator to produce
- Walker
- Added standalone entry point, i.e. default walkers can be used via
require('css-tree/lib/walker')(#47)
- Added standalone entry point, i.e. default walkers can be used via
- Lexer
- Added
defaultkeyword to the list of invalid values for<custom-ident>(since it reversed per spec)
- Added
- Convertors (
toPlainObject()andfromPlainObject()) moved tolib/convertor(entry point isrequire('css-tree/lib/convertor'))
1.0.0-alpha21 (September 5, 2017)
- Tokenizer
- Added
Rawtoken type - Improved tokenization of
url()with raw as url to be more spec complient - Added
Tokenizer#balancearray computation on token layout - Added
Tokenizer#getRawLength()to compute a raw length with respect of block balance - Added
Tokenizer#getTokenStart(offset)method to get token start offset by token index - Added
idxandbalancefields to each token ofTokenizer#dump()method result
- Added
- Parser
- Added
onParseErroroption - Reworked node parsers that consume a
Rawnode to use a new approach. Since now aRawnode builds inparser#Raw()function only - Changed semantic of
parser#Raw(), it takes 5 parameters now (it might to be changed in future) - Changed
parser#tolerantParse()to pass a start token index to fallback function instead of source offset - Fixed
AtruleExpressionconsuming in tolerant mode - Atrule handler to convert an empty
AtruleExpressionnode intonull - Changed
AtruleExpressionhandler to always return a node (before it could return anullin some cases)
- Added
- Lexer
- Fixed comma match node for
#multiplier - Added reference name to
SyntaxReferenceError
- Fixed comma match node for
- Additional fixes on custom errors
- Reduced possible corruption of base config by
syntax.fork()
1.0.0-alpha20 (August 28, 2017)
- Tokenizer
- Added
Atruletoken type (<at-rule-token>per spec) - Added
Functiontoken type (<function-token>per spec) - Added
Urltoken type - Replaced
Tokenizer#getTypes()method withTokenizer#dump()to get all tokens as an array - Renamed
Tokenizer.TYPE.WhitespacetoTokenizer.TYPE.WhiteSpace - Renamed
Tokenizer.findWhitespaceEnd()toTokenizer.findWhiteSpaceEnd()
- Added
- Parser
- Added initial implementation of tollerant mode (turn on by passing
tolerant: trueoption). In this mode parse errors are never occour and any invalid part of CSS turns into aRawnode. Current safe points:Atrule,AtruleExpression,Rule,SelectorandDeclaration. Feature is experimental and further improvements are planned. - Changed
Atrule.expressionto contain aAtruleExpressionnode ornullonly (other node types is wrapping into aAtruleExpressionnode) - Renamed
AttributeSelector.operatortoAttributeSelector.matcher
- Added initial implementation of tollerant mode (turn on by passing
- Generator
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.
- Lexer
- Used mdn/data package as source of lexer's grammar instead of local dictionaries
- Added
xunit to<resolution>generic type - Improved match tree:
- Omited Group (sequences) match nodes
- Omited empty match nodes (for terms with
zero or moremultipliers) - Added
ASTNodenode type to contain a reference to AST node - Fixed node duplication (uncompleted match were added to tree)
- Added AST node reference in match nodes
- Added comma match node by
#multiplier
- Grammar
- 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 - Added
SyntaxParseErrorto grammar export - Reworked group and multipliers representation in syntax tree:
- Replaced
SequenceforGroupnode type (Sequencenode type removed) - Added
explicitboolean property forGroup - Only groups can have a multiplier now (other node types is wrapping into a single term implicit group when multiplier is applied)
- Renamed
nonEmptyGroup's property todisallowEmpty - Added optimisation for syntax tree by dropping redundant root
Groupwhen it contains a singleGroupterm (return thisGroupas a result)
- Replaced
- Changed
- Changed lexer's match functionality
- Changed
Lexer#matchProperty()andLexer#matchType()to return an object instead of match tree. A match tree stores inmatchedfield when AST is matched to grammar successfully, otherwise an error inerrorfield. The result object also has some methods to test AST node against a match tree:getTrace(),isType(),isProperty()andisKeyword() - Added
Lexer#matchDeclaration()method - Removed
Lexer#lastMatchError(error stores in match result object inerrorfield)
- Changed
- Added initial implementation of search for AST segments (new lexer methods:
Lexer#findValueSegments(),Lexer#findDeclarationValueSegments()andLexer#findAllSegments) - Implemented
SyntaxReferenceErrorfor unknown property and type references
- Renamed field in resulting object of
property()function:variable→custom - Fixed issue with readonly properties (e.g.
lineandcolumn) ofErrorand exception on attempt to write in iOS Safari
1.0.0-alpha19 (April 24, 2017)
- Extended
Listclass with new methods:List#prepend(item)List#prependData(data)List#insertData(data)List#insertList(list)List#replace(item, itemOrList)
1.0.0-alpha18 (April 3, 2017)
- Added
atrulewalk context (#39) - Changed a result of generate method for
AnPlusB,AttributeSelector,Function,MediaFeatureandRatio(1e95877) - Fixed typo in
Listexception messages (@strarsis, #42) - Improved tokenizer to convert an input to a string
1.0.0-alpha17 (March 13, 2017)
- Implemented new concept of
syntax- Changed main
exportsto expose a default syntax - Defined initial CSS syntax
- Implemented
createSyntax()method to create a new syntax from scratch - Implemented
fork()method to create a new syntax based on given via extension
- Changed main
- Parser
- Implemented
mediaQueryListandmediaQueryparsing contexts - Implemented
CDOandCDCnode types - Implemented additional declaration property prefix hacks (
#and+) - Added support for UTF-16LE BOM
- Added support for
@font-faceat-rule - Added
chroma()to legacy IE filter functions - Improved
HexColorto consume hex only - Improved support for
\0and\9hacks (#2) - Relaxed number check for
Ratioterms- Allowed fractal values as a
Ratioterm - Disallowed zero number as a
Ratioterm
- Allowed fractal values as a
- Changed important clause parsing
- Allowed any identifier for important (to support hacks like
!ie) - Store
trueforimportantfield in case identifier equals toimportantand string otherwise
- Allowed any identifier for important (to support hacks like
- Fixed parse error formatted message rendering to take into account tabs
- Removed exposing of
Parserclass - Removed
readSelectorSequence(),readSequenceFallback()andreadSelectorSequenceFallbackmethods - Used single universal sequence consumer for
AtruleExpression,SelectorandValue
- Implemented
- Generator
- Reworked generator to use auto-generated functions based on syntax definition (additional work to be done in next releases)
- Implemented
translateMarkup(ast, before, after)method for complex cases - Reworked
translateWithSourceMapto be more flexible (based ontranslateMarkup, additional work to be done in next releases)
- Walker
- Reworked walker to use auto-generated function based on syntax definition (additional work to be done in next releases)
- Lexer
- Prepared for better extensibility (additional work to be done in next releases)
- Implemented
checkStructure(ast)method to check AST structure based on syntax definition - Update syntax dictionaries to latest
mdn/data- Add missing
<'offset-position'>syntax - Extended
<position>property with-webkit-sticky(@sergejmueller, #37)
- Add missing
- Improved mismatch error position
- Implemented script (
gen:syntax) to generate AST format reference page (docs/ast.md) using syntax definition
1.0.0-alpha16 (February 12, 2017)
- Exposed
Parserclass - Added
startOffsetoption toTokenizer(constructor andsetSource()method) - Added fallback functions for default (
readSequenceFallback) and selector (readSelectorSequenceFallback) sequence readers - Fixed edge cases for
AnPlusB - Fixed wrong whitespace ignoring in
Selectorconsumer
1.0.0-alpha15 (February 8, 2017)
- Fixed broken
atruleExpressioncontext - Fixed vendor prefix detection in
keyword()andproperty() - Fixed
property()to not lowercase custom property names - Added
variableboolean flag inproperty()result - Renamed
scannerintotokenizer - Ranamed
syntaxintolexer - Moved
docs/*.htmlfiles to csstree/docs repo - Added
element()function forValuecontext (-moz-element()supported as well) - Merged
Universalnode type intoType - Renamed node types:
Id->IdSelectorClass->ClassSelectorType->TypeSelectorAttribute->AttributeSelectorPseudoClass->PseudoClassSelectorPseudoElement->PseudoElementSelectorHash->HexColorSpace->WhiteSpaceAn+B->AnPlusB
- Removed
Progidnode type - Relaxed
MediaQueryconsumer to not validate syntax on parse and to include whitespaces in children sequence as is - Added
WhiteSpace.valueproperty to store whitespace sequence - Implemented parser options to specify what should be parsed in details (when option is
falsesome part of CSS represents as balancedRaw):parseAtruleExpression– to parse at-rule expressions (trueby default)parseSelector– to parse rule's selector (trueby default)parseValue- to parse declaration's value (trueby default)parseCustomProperty– to parse value and fallback of custom property (falseby default)
- Changed tokenization to stick leading hyphen minus to identifier token
- Changed selector parsing:
- Don't convert spaces into descendant combinator
- Don't validate selector structure on parsing (selectors may be checked by lexer later)
- Initial refactoring of docs
- Various improvements and fixes
1.0.0-alpha14 (February 3, 2017)
- Implemented
DeclarationList,MediaQueryList,MediaQuery,MediaFeatureandRationode types - Implemented
declarationListcontext (useful to parse HTMLstyleattribute content) - Implemented custom consumers for
@import,@media,@pageand@supportsat-rules - Implemented
atruleoption forparse()config, is used foratruleExpessioncontext to specify custom consumer for at-rule if any - Added
Scanner#skipWS(),Scanner#eatNonWS(),Scanner#consume()andScanner#consumeNonWS()helper methods - Added custom consumers for known functional-pseudos, consume unknown functional-pseudo content as balanced
Raw - Allowed any
PseudoElementto be a functional-pseudo (#33) - Improved walker implementations to reduce GC thrashing by reusing cursors
- Changed
Atrule.blockto contain aBlocknode type only if any - Changed
Block.locpositions to include curly brackets - Changed
Atrule.expressionto store anullif no expression - Changed parser to use
StyleSheetnode type only for top level node (when context isstylesheet, that's by default) - Changed
Parentheses,BracketsandFunctionconsumers to use passed sequence reader instead of its own - Changed
ValueandAtruleExpressionconsumers to use common sequence reader (that reader was used byValueconsumer before) - Changed default sequence reader to exclude storage of spaces around
Comma - Changed processing of custom properties:
- Consume declaration value as balanced
Raw - Consume
var()fallback value as balancedRaw - Validate first argument of
var()starts with double dash - Custom property's value and fallback includes spaces around
- Consume declaration value as balanced
- Fixed
Nthto have alocproperty - Fixed
SelectorList.locandSelector.locpositions to exclude spaces - Fixed issue Browserify build fail with
default-syntax.jsonis not found error (#32, @philschatz) - Disallowed
Typeselector starting with dash (parser throws an error in this case now) - Disallowed empty selectors for
Rule(not sure if it's correct but looks reasonable) - Removed
>>combinator support until any browser support (no signals about that yet) - Removed
PseudoElement.legacyproperty - Removed special case for
:before,:after,:first-letterand:first-lineto represent them asPseudoElement, now those pseudos are represented asPseudoClassnodes - Removed deprecated
Syntax#match()method - Parser was splitted into modules and related changes, one step closer to an extensible parser
- Various fixes and improvements, all changes have negligible impact on performance
1.0.0-alpha13 (January 19, 2017)
- Changed location storing in
SyntaxMatchError- Changed property to store mismatch offset to
mismatchOffset - Changed
offsetproperty to store bad node offset in source CSS if any - Added
locproperty that stores bad nodelocif any
- Changed property to store mismatch offset to
1.0.0-alpha12 (January 19, 2017)
- Fixed
Syntax#matchProperty()method to always return a positive result for custom properties since syntax is never defined for them (#31) - Implemented
fromPlainObject()andtoPlainObject()to convert plain object to AST or AST to plain object (currently convertsList<->Array)
1.0.0-alpha11 (January 18, 2017)
- Added support for
:matches(<selector-list>)(#28) - Added support for
:has(<relative-selector-list>) - Added support for
::slotted(<compound-selector>) - Implemented
Bracketsnode type - Implemented basic support for at-rule inside rule block (#24)
- Renamed
Selectornode type toSelectorList - Renamed
SimpleSelectornode type toSelector - Renamed
UnicodeRange.nameproperty toUnicodeRange.value - Replaced
Negationnode type for regularPseudoClass - Unified name of node property to store nested nodes, it always
childrennow:StyleSheet.rules->StyleSheet.childrenSelectorList.selectors->SelectorList.childrenBlock.declarations->Block.children*.sequence->*.children
- Fixed edge cases in parsing
HexandUnicodeRangewhen number not an integer - Changed
nth-pseudos parsing- Implemented
An+Bnode type to represent expressions like2n + 1or-3n - Fixed edge cases when
aorbis not an integer - Changed
oddandevenkeywords processing, keywords are storing asIdentifiernode type now - Changed
Nthnode type format to store anth-query and an optionalselector - Implemented
ofclause fornth-pseudos (a.e.:nth-child(2n + 1 of li, img)) - Limited
Nthparsing rules to:nth-child(),:nth-last-child(),:nth-of-type()and:nth-last-of-type()pseudos
- Implemented
- Changed the way to store locations
- Renamed
infonode property toloc - Changed format of
locto storestartandendpositions
- Renamed
1.0.0-alpha10 (January 11, 2017)
- Reworked
Scannerto be a single point to its functionality - Exposed
Scannerclass to be useful for external projects - Changed
walk()function behaviour to traverse AST nodes in natural order - Implemented
walkUp()function to traverse AST nodes from deepest to parent (behaves aswalk()before)
1.0.0-alpha9 (December 21, 2016)
- Fixed
<angle>generic according to specs that allow a<number>equals to zero to be used as valid value (#30)
1.0.0-alpha8 (November 11, 2016)
- Fixed
Scanner#skip()issue method when cursor is moving to the end of source - Simplified
Progidnode - Changed behaviour for bad selector processing, now parsing fails instead of selector ignoring
- Fixed
<id-selector>generic syntax - Added
qunit for<length>generic syntax - Refactored syntax parser (performance)
- Reduced startup time by implementing lazy syntax parsing (default syntax doesn't parse on module load)
- Updated syntax dictionaries and used
mdn/datainstead ofTemplate:CSSData - Renamed
syntax.stringify()method tosyntax.translate() - Simplified generic syntax functions, those functions receive a single AST node for checking and should return
trueorfalse - Added exception for values that contains
var(), those values are always valid for now - Added more tests and increase code coverage to
98.5%
1.0.0-alpha7 (October 7, 2016)
- Added support for explicit descendant combinator (
>>) - Implemented
TypeandUniversaltype nodes - Improved
Numberparsing by including sign and exponent (#26) - Parse
before,after,first-letterandfirst-linepseudos with single colon asPseudoElement - Changed
FunctionalPseudonode type toPseudoClass - Fixed attribute selector name parsing (namespace edge cases)
- Fixed location calculation for specified offset when
eofis reached - Added more non-standard colors (#25)
- Removed obsolete
Syntax#getAll()method - Fixed various edge cases, code clean up and performance improvements
1.0.0-alpha6 (September 23, 2016)
- More accurate positions for syntax mismatch errors
- Added
applespecific font keywords (#20) - Changed
Propertynode stucture from object to string - Renamed
Rulesetnode type toRule - Removed
Argumentnode type - Fixed
DimensionandPercentageposition computation - Fixed bad selector parsing (temporary solution)
- Fixed location computation for CSS with very long lines that may lead to really long parsing with
positions:true(even freeze) - Fixed
lineandcolumncomputation forSyntaxMatcherror - Improved performance of parsing and translation. Now CSSTree is under 10ms in PostCSS benchmark.