6.6 KiB
6.6 KiB
3.1.1
- Fix: typescript definitions weren't in the published package.
3.1.0
- Fixed numerous bugs in attribute nodes relating to the handling of comments
and whitespace. There's significant changes to
attrNode.spacesandattrNode.rawssince the3.0.0release. - Added
Attribute#offsetOf(part)to get the offset location of attribute parts like"operator"and"value". This is most often added toAttribute#sourceIndexfor error reporting.
3.0.0
Breaking changes
- Some tweaks to the tokenizer/attribute selector parsing mean that whitespace locations might be slightly different to the 2.x code.
- Better attribute selector parsing with more validation; postcss-selector-parser no longer uses regular expressions to parse attribute selectors.
- Added an async API (thanks to @jacobp100); the default
processAPI is now async, and the sync API is now accessed throughprocessSyncinstead. process()andprocessSync()now return a string instead of the Processor instance.- Tweaks handling of Less interpolation (thanks to @jwilsson).
- Removes support for Node 0.12.
Other changes
ast()andastSync()methods have been added to theProcessor. These return theRootnode of the selectors after processing them.transform()andtransformSync()methods have been added to theProcessor. These return the value returned by the processor callback after processing the selectors.- Set the parent when inserting a node (thanks to @chriseppstein).
- Correctly adjust indices when using insertBefore/insertAfter (thanks to @tivac).
- Fixes handling of namespaces with qualified tag selectors.
process,astandtransform(and their sync variants) now accept apostcssrule node. When provided, better errors are generated and selector processing is automatically set back to the rule selector (unless theupdateSelectoroption is set tofalse.)- Now more memory efficient when tokenizing selectors.
Upgrade hints
The pattern of:
rule.selector = processor.process(rule.selector).result.toString();
is now:
processor.processSync(rule)
2.2.3
- Resolves an issue where the parser would not reduce multiple spaces between an ampersand and another simple selector in lossy mode (thanks to @adam-26).
2.2.2
- No longer hangs on an unescaped semicolon; instead the parser will throw an exception for these cases.
2.2.1
- Allows a consumer to specify whitespace tokens when creating a new Node (thanks to @Semigradsky).
2.2.0
- Added a new option to normalize whitespace when parsing the selector string (thanks to @adam-26).
2.1.1
- Better unquoted value handling within attribute selectors (thanks to @evilebottnawi).
2.1.0
- Added: Use string constants for all node types & expose them on the main parser instance (thanks to @Aweary).
# 2.0.0
This release contains the following breaking changes:
- Renamed all
eachInsideiterators towalk. For example,eachTagis nowwalkTags, andeachInsideis nowwalk. - Renamed
Node#removeSelf()toNode#remove(). - Renamed
Container#remove()toContainer#removeChild(). - Renamed
Node#rawtoNode#raws(thanks to @davidtheclark). - Now parses
&as the nesting selector, rather than a tag selector. - Fixes misinterpretation of Sass interpolation (e.g.
#{foo}) as an id selector (thanks to @davidtheclark).
and;
- Fixes parsing of attribute selectors with equals signs in them
(e.g.
[data-attr="foo=bar"]) (thanks to @montmanu). - Adds
quotedandraw.unquotedproperties to attribute nodes (thanks to @davidtheclark).
1.3.3
- Fixes an infinite loop on
)and]tokens when they had no opening pairs. Now postcss-selector-parser will throw when it encounters these lone tokens.
# 1.3.2
- Now uses plain integers rather than
str.charCodeAt(0)for compiled builds.
1.3.1
- Update flatten to v1.x (thanks to @shinnn).
1.3.0
- Adds a new node type,
String, to fix a crash on selectors such asfoo:bar("test").
1.2.1
- Fixes a crash when the parser encountered a trailing combinator.
1.2.0
- A more descriptive error is thrown when the parser expects to find a pseudo-class/pseudo-element (thanks to @ashelley).
- Adds support for line/column locations for selector nodes, as well as a
Node#sourceIndexmethod (thanks to @davidtheclark).
1.1.4
- Fixes a crash when a selector started with a
>combinator. The module will now no longer throw if a selector has a leading/trailing combinator node.
1.1.3
- Fixes a crash on
@tokens.
1.1.2
- Fixes an infinite loop caused by using parentheses in a non-pseudo element context.
1.1.1
- Fixes a crash when a backslash ended a selector string.
1.1.0
- Adds support for replacing multiple nodes at once with
replaceWith(thanks to @jonathantneal). - Parser no longer throws on sequential IDs and trailing commas, to support parsing of selector hacks.
1.0.1
- Fixes using
insertAfterandinsertBeforeduring iteration.
1.0.0
- Adds
cloneandreplaceWithmethods to nodes. - Adds
insertBeforeandinsertAfterto containers. - Stabilises API.
0.0.5
- Fixes crash on extra whitespace inside a pseudo selector's parentheses.
- Adds sort function to the container class.
- Enables the parser to pass its input through without transforming.
- Iteration-safe
eachandeachInside.
0.0.4
- Tidy up redundant duplication.
- Fixes a bug where the parser would loop infinitely on universal selectors inside pseudo selectors.
- Adds
lengthgetter andeachInside,map,reduceto the container class. - When a selector has been removed from the tree, the root node will no longer cast it to a string.
- Adds node type iterators to the container class (e.g.
eachComment). - Adds filter function to the container class.
- Adds split function to the container class.
- Create new node types by doing
parser.id(opts)etc. - Adds support for pseudo classes anywhere in the selector.
0.0.3
- Adds
nextandprevto the node class. - Adds
firstandlastgetters to the container class. - Adds
everyandsomeiterators to the container class. - Add
emptyalias forremoveAll. - Combinators are now types of node.
- Fixes the at method so that it is not an alias for
index. - Tidy up creation of new nodes in the parser.
- Refactors how namespaces are handled for consistency & less redundant code.
- Refactors AST to use
nodesexclusively, and eliminates excessive nesting. - Fixes nested pseudo parsing.
- Fixes whitespace parsing.
0.0.2
- Adds support for namespace selectors.
- Adds support for selectors joined by escaped spaces - such as
.\31\ 0.
0.0.1
- Initial release.