| 1 | # 6.1.2
|
|---|
| 2 |
|
|---|
| 3 | - Fixed: erroneous trailing combinators in pseudos
|
|---|
| 4 |
|
|---|
| 5 | # 6.1.1
|
|---|
| 6 |
|
|---|
| 7 | - Fixed: improve typings of constructor helpers (#292)
|
|---|
| 8 |
|
|---|
| 9 | # 6.1.0
|
|---|
| 10 |
|
|---|
| 11 | - Feature: add `sourceIndex` to `Selector` nodes (#290)
|
|---|
| 12 |
|
|---|
| 13 | # 6.0.16
|
|---|
| 14 |
|
|---|
| 15 | - Fixed: add missing `index` argument to `each`/`walk` callback types (#289)
|
|---|
| 16 |
|
|---|
| 17 | # 6.0.15
|
|---|
| 18 |
|
|---|
| 19 | - Fixed: Node#prev and Node#next type for the first/last node
|
|---|
| 20 |
|
|---|
| 21 | # 6.0.14
|
|---|
| 22 |
|
|---|
| 23 | - Fixed: type definitions
|
|---|
| 24 |
|
|---|
| 25 | # 6.0.13
|
|---|
| 26 |
|
|---|
| 27 | - Fixed: throw on unexpected pipe symbols
|
|---|
| 28 |
|
|---|
| 29 | # 6.0.12
|
|---|
| 30 |
|
|---|
| 31 | - Fixed: `clone` arguments should be optional
|
|---|
| 32 |
|
|---|
| 33 | # 6.0.11
|
|---|
| 34 |
|
|---|
| 35 | - Fixed: parse attribute case insensitivity flag
|
|---|
| 36 |
|
|---|
| 37 | # 6.0.10
|
|---|
| 38 |
|
|---|
| 39 | - Fixed: `isPseudoElement()` supports `:first-letter` and `:first-line`
|
|---|
| 40 |
|
|---|
| 41 | # 6.0.9
|
|---|
| 42 |
|
|---|
| 43 | - Fixed: `Combinator.raws` property type
|
|---|
| 44 |
|
|---|
| 45 | # 6.0.8
|
|---|
| 46 |
|
|---|
| 47 | - Fixed: reduced size
|
|---|
| 48 |
|
|---|
| 49 | # 6.0.7
|
|---|
| 50 |
|
|---|
| 51 | - Fixed: parse animation percents
|
|---|
| 52 |
|
|---|
| 53 | # 6.0.6
|
|---|
| 54 |
|
|---|
| 55 | - Fixed: parse quoted attributes containing a newline correctly
|
|---|
| 56 |
|
|---|
| 57 | # 6.0.5
|
|---|
| 58 |
|
|---|
| 59 | - Perf: rework unesc for a 63+% performance boost
|
|---|
| 60 |
|
|---|
| 61 | # 6.0.4
|
|---|
| 62 |
|
|---|
| 63 | - Fixed: ts errors
|
|---|
| 64 |
|
|---|
| 65 | # 6.0.3
|
|---|
| 66 |
|
|---|
| 67 | - Fixed: replace node built-in "util" module with "util-deprecate"
|
|---|
| 68 | - Fixed: handle uppercase pseudo elements
|
|---|
| 69 | - Fixed: do not create invalid combinator before comment
|
|---|
| 70 |
|
|---|
| 71 | # 6.0.2
|
|---|
| 72 |
|
|---|
| 73 | - Fixed an issue with parsing and stringifying an empty attribute value
|
|---|
| 74 |
|
|---|
| 75 | # 6.0.1
|
|---|
| 76 |
|
|---|
| 77 | - Fixed an issue with unicode surrogate pair parsing
|
|---|
| 78 |
|
|---|
| 79 | # 6.0.0
|
|---|
| 80 |
|
|---|
| 81 | - Updated: `cssesc` to 3.0.0 (major)
|
|---|
| 82 | - Fixed: Issues with escaped `id` and `class` selectors
|
|---|
| 83 |
|
|---|
| 84 | # 5.0.0
|
|---|
| 85 |
|
|---|
| 86 | - Allow escaped dot within class name.
|
|---|
| 87 | - Update PostCSS to 7.0.7 (patch)
|
|---|
| 88 |
|
|---|
| 89 | # 5.0.0-rc.4
|
|---|
| 90 |
|
|---|
| 91 | - Fixed an issue where comments immediately after an insensitive (in attribute)
|
|---|
| 92 | were not parsed correctly.
|
|---|
| 93 | - Updated `cssesc` to 2.0.0 (major).
|
|---|
| 94 | - Removed outdated integration tests.
|
|---|
| 95 | - Added tests for custom selectors, tags with attributes, the universal
|
|---|
| 96 | selector with pseudos, and tokens after combinators.
|
|---|
| 97 |
|
|---|
| 98 | # 5.0.0-rc.1
|
|---|
| 99 |
|
|---|
| 100 | To ease adoption of the v5.0 release, we have relaxed the node version
|
|---|
| 101 | check performed by npm at installation time to allow for node 4, which
|
|---|
| 102 | remains officially unsupported, but likely to continue working for the
|
|---|
| 103 | time being.
|
|---|
| 104 |
|
|---|
| 105 | # 5.0.0-rc.0
|
|---|
| 106 |
|
|---|
| 107 | This release has **BREAKING CHANGES** that were required to fix regressions
|
|---|
| 108 | in 4.0.0 and to make the Combinator Node API consistent for all combinator
|
|---|
| 109 | types. Please read carefully.
|
|---|
| 110 |
|
|---|
| 111 | ## Summary of Changes
|
|---|
| 112 |
|
|---|
| 113 | * The way a descendent combinator that isn't a single space character (E.g. `.a .b`) is stored in the AST has changed.
|
|---|
| 114 | * Named Combinators (E.g. `.a /for/ .b`) are now properly parsed as a combinator.
|
|---|
| 115 | * It is now possible to look up a node based on the source location of a character in that node and to query nodes if they contain some character.
|
|---|
| 116 | * Several bug fixes that caused the parser to hang and run out of memory when a `/` was encountered have been fixed.
|
|---|
| 117 | * The minimum supported version of Node is now `v6.0.0`.
|
|---|
| 118 |
|
|---|
| 119 | ### Changes to the Descendent Combinator
|
|---|
| 120 |
|
|---|
| 121 | In prior releases, the value of a descendant combinator with multiple spaces included all the spaces.
|
|---|
| 122 |
|
|---|
| 123 | * `.a .b`: Extra spaces are now stored as space before.
|
|---|
| 124 | - Old & Busted:
|
|---|
| 125 | - `combinator.value === " "`
|
|---|
| 126 | - New hotness:
|
|---|
| 127 | - `combinator.value === " " && combinator.spaces.before === " "`
|
|---|
| 128 | * `.a /*comment*/.b`: A comment at the end of the combinator causes extra space to become after space.
|
|---|
| 129 | - Old & Busted:
|
|---|
| 130 | - `combinator.value === " "`
|
|---|
| 131 | - `combinator.raws.value === " /*comment/"`
|
|---|
| 132 | - New hotness:
|
|---|
| 133 | - `combinator.value === " "`
|
|---|
| 134 | - `combinator.spaces.after === " "`
|
|---|
| 135 | - `combinator.raws.spaces.after === " /*comment*/"`
|
|---|
| 136 | * `.a<newline>.b`: whitespace that doesn't start or end with a single space character is stored as a raw value.
|
|---|
| 137 | - Old & Busted:
|
|---|
| 138 | - `combinator.value === "\n"`
|
|---|
| 139 | - `combinator.raws.value === undefined`
|
|---|
| 140 | - New hotness:
|
|---|
| 141 | - `combinator.value === " "`
|
|---|
| 142 | - `combinator.raws.value === "\n"`
|
|---|
| 143 |
|
|---|
| 144 | ### Support for "Named Combinators"
|
|---|
| 145 |
|
|---|
| 146 | Although, nonstandard and unlikely to ever become a standard, combinators like `/deep/` and `/for/` are now properly supported.
|
|---|
| 147 |
|
|---|
| 148 | Because they've been taken off the standardization track, there is no spec-official name for combinators of the form `/<ident>/`. However, I talked to [Tab Atkins](https://twitter.com/tabatkins) and we agreed to call them "named combinators" so now they are called that.
|
|---|
| 149 |
|
|---|
| 150 | Before this release such named combinators were parsed without intention and generated three nodes of type `"tag"` where the first and last nodes had a value of `"/"`.
|
|---|
| 151 |
|
|---|
| 152 | * `.a /for/ .b` is parsed as a combinator.
|
|---|
| 153 | - Old & Busted:
|
|---|
| 154 | - `root.nodes[0].nodes[1].type === "tag"`
|
|---|
| 155 | - `root.nodes[0].nodes[1].value === "/"`
|
|---|
| 156 | - New hotness:
|
|---|
| 157 | - `root.nodes[0].nodes[1].type === "combinator"`
|
|---|
| 158 | - `root.nodes[0].nodes[1].value === "/for/"`
|
|---|
| 159 | * `.a /F\6fR/ .b` escapes are handled and uppercase is normalized.
|
|---|
| 160 | - Old & Busted:
|
|---|
| 161 | - `root.nodes[0].nodes[2].type === "tag"`
|
|---|
| 162 | - `root.nodes[0].nodes[2].value === "F\\6fR"`
|
|---|
| 163 | - New hotness:
|
|---|
| 164 | - `root.nodes[0].nodes[1].type === "combinator"`
|
|---|
| 165 | - `root.nodes[0].nodes[1].value === "/for/"`
|
|---|
| 166 | - `root.nodes[0].nodes[1].raws.value === "/F\\6fR/"`
|
|---|
| 167 |
|
|---|
| 168 | ### Source position checks and lookups
|
|---|
| 169 |
|
|---|
| 170 | A new API was added to look up a node based on the source location.
|
|---|
| 171 |
|
|---|
| 172 | ```js
|
|---|
| 173 | const selectorParser = require("postcss-selector-parser");
|
|---|
| 174 | // You can find the most specific node for any given character
|
|---|
| 175 | let combinator = selectorParser.astSync(".a > .b").atPosition(1,4);
|
|---|
| 176 | combinator.toString() === " > ";
|
|---|
| 177 | // You can check if a node includes a specific character
|
|---|
| 178 | // Whitespace surrounding the node that is owned by that node
|
|---|
| 179 | // is included in the check.
|
|---|
| 180 | [2,3,4,5,6].map(column => combinator.isAtPosition(1, column));
|
|---|
| 181 | // => [false, true, true, true, false]
|
|---|
| 182 | ```
|
|---|
| 183 |
|
|---|
| 184 | # 4.0.0
|
|---|
| 185 |
|
|---|
| 186 | This release has **BREAKING CHANGES** that were required to fix bugs regarding values with escape sequences. Please read carefully.
|
|---|
| 187 |
|
|---|
| 188 | * **Identifiers with escapes** - CSS escape sequences are now hidden from the public API by default.
|
|---|
| 189 | The normal value of a node like a class name or ID, or an aspect of a node such as attribute
|
|---|
| 190 | selector's value, is unescaped. Escapes representing Non-ascii characters are unescaped into
|
|---|
| 191 | unicode characters. For example: `bu\tton, .\31 00, #i\2764\FE0Fu, [attr="value is \"quoted\""]`
|
|---|
| 192 | will parse respectively to the values `button`, `100`, `i❤️u`, `value is "quoted"`.
|
|---|
| 193 | The original escape sequences for these values can be found in the corresponding property name
|
|---|
| 194 | in `node.raws`. Where possible, deprecation warnings were added, but the nature
|
|---|
| 195 | of escape handling makes it impossible to detect what is escaped or not. Our expectation is
|
|---|
| 196 | that most users are neither expecting nor handling escape sequences in their use of this library,
|
|---|
| 197 | and so for them, this is a bug fix. Users who are taking care to handle escapes correctly can
|
|---|
| 198 | now update their code to remove the escape handling and let us do it for them.
|
|---|
| 199 |
|
|---|
| 200 | * **Mutating values with escapes** - When you make an update to a node property that has escape handling
|
|---|
| 201 | The value is assumed to be unescaped, and any special characters are escaped automatically and
|
|---|
| 202 | the corresponding `raws` value is immediately updated. This can result in changes to the original
|
|---|
| 203 | escape format. Where the exact value of the escape sequence is important there are methods that
|
|---|
| 204 | allow both values to be set in conjunction. There are a number of new convenience methods for
|
|---|
| 205 | manipulating values that involve escapes, especially for attributes values where the quote mark
|
|---|
| 206 | is involved. See https://github.com/postcss/postcss-selector-parser/pull/133 for an extensive
|
|---|
| 207 | write-up on these changes.
|
|---|
| 208 |
|
|---|
| 209 |
|
|---|
| 210 | **Upgrade/API Example**
|
|---|
| 211 |
|
|---|
| 212 | In `3.x` there was no unescape handling and internal consistency of several properties was the caller's job to maintain. It was very easy for the developer
|
|---|
| 213 | to create a CSS file that did not parse correctly when some types of values
|
|---|
| 214 | were in use.
|
|---|
| 215 |
|
|---|
| 216 | ```js
|
|---|
| 217 | const selectorParser = require("postcss-selector-parser");
|
|---|
| 218 | let attr = selectorParser.attribute({attribute: "id", operator: "=", value: "a-value"});
|
|---|
| 219 | attr.value; // => "a-value"
|
|---|
| 220 | attr.toString(); // => [id=a-value]
|
|---|
| 221 | // Add quotes to an attribute's value.
|
|---|
| 222 | // All these values have to be set by the caller to be consistent:
|
|---|
| 223 | // no internal consistency is maintained.
|
|---|
| 224 | attr.raws.unquoted = attr.value
|
|---|
| 225 | attr.value = "'" + attr.value + "'";
|
|---|
| 226 | attr.value; // => "'a-value'"
|
|---|
| 227 | attr.quoted = true;
|
|---|
| 228 | attr.toString(); // => "[id='a-value']"
|
|---|
| 229 | ```
|
|---|
| 230 |
|
|---|
| 231 | In `4.0` there is a convenient API for setting and mutating values
|
|---|
| 232 | that may need escaping. Especially for attributes.
|
|---|
| 233 |
|
|---|
| 234 | ```js
|
|---|
| 235 | const selectorParser = require("postcss-selector-parser");
|
|---|
| 236 |
|
|---|
| 237 | // The constructor requires you specify the exact escape sequence
|
|---|
| 238 | let className = selectorParser.className({value: "illegal class name", raws: {value: "illegal\\ class\\ name"}});
|
|---|
| 239 | className.toString(); // => '.illegal\\ class\\ name'
|
|---|
| 240 |
|
|---|
| 241 | // So it's better to set the value as a property
|
|---|
| 242 | className = selectorParser.className();
|
|---|
| 243 | // Most properties that deal with identifiers work like this
|
|---|
| 244 | className.value = "escape for me";
|
|---|
| 245 | className.value; // => 'escape for me'
|
|---|
| 246 | className.toString(); // => '.escape\\ for\\ me'
|
|---|
| 247 |
|
|---|
| 248 | // emoji and all non-ascii are escaped to ensure it works in every css file.
|
|---|
| 249 | className.value = "😱🦄😍";
|
|---|
| 250 | className.value; // => '😱🦄😍'
|
|---|
| 251 | className.toString(); // => '.\\1F631\\1F984\\1F60D'
|
|---|
| 252 |
|
|---|
| 253 | // you can control the escape sequence if you want, or do bad bad things
|
|---|
| 254 | className.setPropertyAndEscape('value', 'xxxx', 'yyyy');
|
|---|
| 255 | className.value; // => "xxxx"
|
|---|
| 256 | className.toString(); // => ".yyyy"
|
|---|
| 257 |
|
|---|
| 258 | // Pass a value directly through to the css output without escaping it.
|
|---|
| 259 | className.setPropertyWithoutEscape('value', '$REPLACE_ME$');
|
|---|
| 260 | className.value; // => "$REPLACE_ME$"
|
|---|
| 261 | className.toString(); // => ".$REPLACE_ME$"
|
|---|
| 262 |
|
|---|
| 263 | // The biggest changes are to the Attribute class
|
|---|
| 264 | // passing quoteMark explicitly is required to avoid a deprecation warning.
|
|---|
| 265 | let attr = selectorParser.attribute({attribute: "id", operator: "=", value: "a-value", quoteMark: null});
|
|---|
| 266 | attr.toString(); // => "[id=a-value]"
|
|---|
| 267 | // Get the value with quotes on it and any necessary escapes.
|
|---|
| 268 | // This is the same as reading attr.value in 3.x.
|
|---|
| 269 | attr.getQuotedValue(); // => "a-value";
|
|---|
| 270 | attr.quoteMark; // => null
|
|---|
| 271 |
|
|---|
| 272 | // Add quotes to an attribute's value.
|
|---|
| 273 | attr.quoteMark = "'"; // This is all that's required.
|
|---|
| 274 | attr.toString(); // => "[id='a-value']"
|
|---|
| 275 | attr.quoted; // => true
|
|---|
| 276 | // The value is still the same, only the quotes have changed.
|
|---|
| 277 | attr.value; // => a-value
|
|---|
| 278 | attr.getQuotedValue(); // => "'a-value'";
|
|---|
| 279 |
|
|---|
| 280 | // deprecated assignment, no warning because there's no escapes
|
|---|
| 281 | attr.value = "new-value";
|
|---|
| 282 | // no quote mark is needed so it is removed
|
|---|
| 283 | attr.getQuotedValue(); // => "new-value";
|
|---|
| 284 |
|
|---|
| 285 | // deprecated assignment,
|
|---|
| 286 | attr.value = "\"a 'single quoted' value\"";
|
|---|
| 287 | // > (node:27859) DeprecationWarning: Assigning an attribute a value containing characters that might need to be escaped is deprecated. Call attribute.setValue() instead.
|
|---|
| 288 | attr.getQuotedValue(); // => '"a \'single quoted\' value"';
|
|---|
| 289 | // quote mark inferred from first and last characters.
|
|---|
| 290 | attr.quoteMark; // => '"'
|
|---|
| 291 |
|
|---|
| 292 | // setValue takes options to make manipulating the value simple.
|
|---|
| 293 | attr.setValue('foo', {smart: true});
|
|---|
| 294 | // foo doesn't require any escapes or quotes.
|
|---|
| 295 | attr.toString(); // => '[id=foo]'
|
|---|
| 296 | attr.quoteMark; // => null
|
|---|
| 297 |
|
|---|
| 298 | // An explicit quote mark can be specified
|
|---|
| 299 | attr.setValue('foo', {quoteMark: '"'});
|
|---|
| 300 | attr.toString(); // => '[id="foo"]'
|
|---|
| 301 |
|
|---|
| 302 | // preserves quote mark by default
|
|---|
| 303 | attr.setValue('bar');
|
|---|
| 304 | attr.toString(); // => '[id="bar"]'
|
|---|
| 305 | attr.quoteMark = null;
|
|---|
| 306 | attr.toString(); // => '[id=bar]'
|
|---|
| 307 |
|
|---|
| 308 | // with no arguments, it preserves quote mark even when it's not a great idea
|
|---|
| 309 | attr.setValue('a value \n that should be quoted');
|
|---|
| 310 | attr.toString(); // => '[id=a\\ value\\ \\A\\ that\\ should\\ be\\ quoted]'
|
|---|
| 311 |
|
|---|
| 312 | // smart preservation with a specified default
|
|---|
| 313 | attr.setValue('a value \n that should be quoted', {smart: true, preferCurrentQuoteMark: true, quoteMark: "'"});
|
|---|
| 314 | // => "[id='a value \\A that should be quoted']"
|
|---|
| 315 | attr.quoteMark = '"';
|
|---|
| 316 | // => '[id="a value \\A that should be quoted"]'
|
|---|
| 317 |
|
|---|
| 318 | // this keeps double quotes because it wants to quote the value and the existing value has double quotes.
|
|---|
| 319 | attr.setValue('this should be quoted', {smart: true, preferCurrentQuoteMark: true, quoteMark: "'"});
|
|---|
| 320 | // => '[id="this should be quoted"]'
|
|---|
| 321 |
|
|---|
| 322 | // picks single quotes because the value has double quotes
|
|---|
| 323 | attr.setValue('a "double quoted" value', {smart: true, preferCurrentQuoteMark: true, quoteMark: "'"});
|
|---|
| 324 | // => "[id='a "double quoted" value']"
|
|---|
| 325 |
|
|---|
| 326 | // setPropertyAndEscape lets you do anything you want. Even things that are a bad idea and illegal.
|
|---|
| 327 | attr.setPropertyAndEscape('value', 'xxxx', 'the password is 42');
|
|---|
| 328 | attr.value; // => "xxxx"
|
|---|
| 329 | attr.toString(); // => "[id=the password is 42]"
|
|---|
| 330 |
|
|---|
| 331 | // Pass a value directly through to the css output without escaping it.
|
|---|
| 332 | attr.setPropertyWithoutEscape('value', '$REPLACEMENT$');
|
|---|
| 333 | attr.value; // => "$REPLACEMENT$"
|
|---|
| 334 | attr.toString(); // => "[id=$REPLACEMENT$]"
|
|---|
| 335 | ```
|
|---|
| 336 |
|
|---|
| 337 | # 3.1.2
|
|---|
| 338 |
|
|---|
| 339 | * Fix: Removed dot-prop dependency since it's no longer written in es5.
|
|---|
| 340 |
|
|---|
| 341 | # 3.1.1
|
|---|
| 342 |
|
|---|
| 343 | * Fix: typescript definitions weren't in the published package.
|
|---|
| 344 |
|
|---|
| 345 | # 3.1.0
|
|---|
| 346 |
|
|---|
| 347 | * Fixed numerous bugs in attribute nodes relating to the handling of comments
|
|---|
| 348 | and whitespace. There's significant changes to `attrNode.spaces` and `attrNode.raws` since the `3.0.0` release.
|
|---|
| 349 | * Added `Attribute#offsetOf(part)` to get the offset location of
|
|---|
| 350 | attribute parts like `"operator"` and `"value"`. This is most
|
|---|
| 351 | often added to `Attribute#sourceIndex` for error reporting.
|
|---|
| 352 |
|
|---|
| 353 | # 3.0.0
|
|---|
| 354 |
|
|---|
| 355 | ## Breaking changes
|
|---|
| 356 |
|
|---|
| 357 | * Some tweaks to the tokenizer/attribute selector parsing mean that whitespace
|
|---|
| 358 | locations might be slightly different to the 2.x code.
|
|---|
| 359 | * Better attribute selector parsing with more validation; postcss-selector-parser
|
|---|
| 360 | no longer uses regular expressions to parse attribute selectors.
|
|---|
| 361 | * Added an async API (thanks to @jacobp100); the default `process` API is now
|
|---|
| 362 | async, and the sync API is now accessed through `processSync` instead.
|
|---|
| 363 | * `process()` and `processSync()` now return a string instead of the Processor
|
|---|
| 364 | instance.
|
|---|
| 365 | * Tweaks handling of Less interpolation (thanks to @jwilsson).
|
|---|
| 366 | * Removes support for Node 0.12.
|
|---|
| 367 |
|
|---|
| 368 | ## Other changes
|
|---|
| 369 |
|
|---|
| 370 | * `ast()` and `astSync()` methods have been added to the `Processor`. These
|
|---|
| 371 | return the `Root` node of the selectors after processing them.
|
|---|
| 372 | * `transform()` and `transformSync()` methods have been added to the
|
|---|
| 373 | `Processor`. These return the value returned by the processor callback
|
|---|
| 374 | after processing the selectors.
|
|---|
| 375 | * Set the parent when inserting a node (thanks to @chriseppstein).
|
|---|
| 376 | * Correctly adjust indices when using insertBefore/insertAfter (thanks to @tivac).
|
|---|
| 377 | * Fixes handling of namespaces with qualified tag selectors.
|
|---|
| 378 | * `process`, `ast` and `transform` (and their sync variants) now accept a
|
|---|
| 379 | `postcss` rule node. When provided, better errors are generated and selector
|
|---|
| 380 | processing is automatically set back to the rule selector (unless the `updateSelector` option is set to `false`.)
|
|---|
| 381 | * Now more memory efficient when tokenizing selectors.
|
|---|
| 382 |
|
|---|
| 383 | ### Upgrade hints
|
|---|
| 384 |
|
|---|
| 385 | The pattern of:
|
|---|
| 386 |
|
|---|
| 387 | `rule.selector = processor.process(rule.selector).result.toString();`
|
|---|
| 388 |
|
|---|
| 389 | is now:
|
|---|
| 390 |
|
|---|
| 391 | `processor.processSync(rule)`
|
|---|
| 392 |
|
|---|
| 393 | # 2.2.3
|
|---|
| 394 |
|
|---|
| 395 | * Resolves an issue where the parser would not reduce multiple spaces between an
|
|---|
| 396 | ampersand and another simple selector in lossy mode (thanks to @adam-26).
|
|---|
| 397 |
|
|---|
| 398 | # 2.2.2
|
|---|
| 399 |
|
|---|
| 400 | * No longer hangs on an unescaped semicolon; instead the parser will throw
|
|---|
| 401 | an exception for these cases.
|
|---|
| 402 |
|
|---|
| 403 | # 2.2.1
|
|---|
| 404 |
|
|---|
| 405 | * Allows a consumer to specify whitespace tokens when creating a new Node
|
|---|
| 406 | (thanks to @Semigradsky).
|
|---|
| 407 |
|
|---|
| 408 | # 2.2.0
|
|---|
| 409 |
|
|---|
| 410 | * Added a new option to normalize whitespace when parsing the selector string
|
|---|
| 411 | (thanks to @adam-26).
|
|---|
| 412 |
|
|---|
| 413 | # 2.1.1
|
|---|
| 414 |
|
|---|
| 415 | * Better unquoted value handling within attribute selectors
|
|---|
| 416 | (thanks to @evilebottnawi).
|
|---|
| 417 |
|
|---|
| 418 | # 2.1.0
|
|---|
| 419 |
|
|---|
| 420 | * Added: Use string constants for all node types & expose them on the main
|
|---|
| 421 | parser instance (thanks to @Aweary).
|
|---|
| 422 |
|
|---|
| 423 | # 2.0.0
|
|---|
| 424 |
|
|---|
| 425 | This release contains the following breaking changes:
|
|---|
| 426 |
|
|---|
| 427 | * Renamed all `eachInside` iterators to `walk`. For example, `eachTag` is now
|
|---|
| 428 | `walkTags`, and `eachInside` is now `walk`.
|
|---|
| 429 | * Renamed `Node#removeSelf()` to `Node#remove()`.
|
|---|
| 430 | * Renamed `Container#remove()` to `Container#removeChild()`.
|
|---|
| 431 | * Renamed `Node#raw` to `Node#raws` (thanks to @davidtheclark).
|
|---|
| 432 | * Now parses `&` as the *nesting* selector, rather than a *tag* selector.
|
|---|
| 433 | * Fixes misinterpretation of Sass interpolation (e.g. `#{foo}`) as an
|
|---|
| 434 | id selector (thanks to @davidtheclark).
|
|---|
| 435 |
|
|---|
| 436 | and;
|
|---|
| 437 |
|
|---|
| 438 | * Fixes parsing of attribute selectors with equals signs in them
|
|---|
| 439 | (e.g. `[data-attr="foo=bar"]`) (thanks to @montmanu).
|
|---|
| 440 | * Adds `quoted` and `raw.unquoted` properties to attribute nodes
|
|---|
| 441 | (thanks to @davidtheclark).
|
|---|
| 442 |
|
|---|
| 443 | # 1.3.3
|
|---|
| 444 |
|
|---|
| 445 | * Fixes an infinite loop on `)` and `]` tokens when they had no opening pairs.
|
|---|
| 446 | Now postcss-selector-parser will throw when it encounters these lone tokens.
|
|---|
| 447 |
|
|---|
| 448 | # 1.3.2
|
|---|
| 449 |
|
|---|
| 450 | * Now uses plain integers rather than `str.charCodeAt(0)` for compiled builds.
|
|---|
| 451 |
|
|---|
| 452 | # 1.3.1
|
|---|
| 453 |
|
|---|
| 454 | * Update flatten to v1.x (thanks to @shinnn).
|
|---|
| 455 |
|
|---|
| 456 | # 1.3.0
|
|---|
| 457 |
|
|---|
| 458 | * Adds a new node type, `String`, to fix a crash on selectors such as
|
|---|
| 459 | `foo:bar("test")`.
|
|---|
| 460 |
|
|---|
| 461 | # 1.2.1
|
|---|
| 462 |
|
|---|
| 463 | * Fixes a crash when the parser encountered a trailing combinator.
|
|---|
| 464 |
|
|---|
| 465 | # 1.2.0
|
|---|
| 466 |
|
|---|
| 467 | * A more descriptive error is thrown when the parser expects to find a
|
|---|
| 468 | pseudo-class/pseudo-element (thanks to @ashelley).
|
|---|
| 469 | * Adds support for line/column locations for selector nodes, as well as a
|
|---|
| 470 | `Node#sourceIndex` method (thanks to @davidtheclark).
|
|---|
| 471 |
|
|---|
| 472 | # 1.1.4
|
|---|
| 473 |
|
|---|
| 474 | * Fixes a crash when a selector started with a `>` combinator. The module will
|
|---|
| 475 | now no longer throw if a selector has a leading/trailing combinator node.
|
|---|
| 476 |
|
|---|
| 477 | # 1.1.3
|
|---|
| 478 |
|
|---|
| 479 | * Fixes a crash on `@` tokens.
|
|---|
| 480 |
|
|---|
| 481 | # 1.1.2
|
|---|
| 482 |
|
|---|
| 483 | * Fixes an infinite loop caused by using parentheses in a non-pseudo element
|
|---|
| 484 | context.
|
|---|
| 485 |
|
|---|
| 486 | # 1.1.1
|
|---|
| 487 |
|
|---|
| 488 | * Fixes a crash when a backslash ended a selector string.
|
|---|
| 489 |
|
|---|
| 490 | # 1.1.0
|
|---|
| 491 |
|
|---|
| 492 | * Adds support for replacing multiple nodes at once with `replaceWith`
|
|---|
| 493 | (thanks to @jonathantneal).
|
|---|
| 494 | * Parser no longer throws on sequential IDs and trailing commas, to support
|
|---|
| 495 | parsing of selector hacks.
|
|---|
| 496 |
|
|---|
| 497 | # 1.0.1
|
|---|
| 498 |
|
|---|
| 499 | * Fixes using `insertAfter` and `insertBefore` during iteration.
|
|---|
| 500 |
|
|---|
| 501 | # 1.0.0
|
|---|
| 502 |
|
|---|
| 503 | * Adds `clone` and `replaceWith` methods to nodes.
|
|---|
| 504 | * Adds `insertBefore` and `insertAfter` to containers.
|
|---|
| 505 | * Stabilises API.
|
|---|
| 506 |
|
|---|
| 507 | # 0.0.5
|
|---|
| 508 |
|
|---|
| 509 | * Fixes crash on extra whitespace inside a pseudo selector's parentheses.
|
|---|
| 510 | * Adds sort function to the container class.
|
|---|
| 511 | * Enables the parser to pass its input through without transforming.
|
|---|
| 512 | * Iteration-safe `each` and `eachInside`.
|
|---|
| 513 |
|
|---|
| 514 | # 0.0.4
|
|---|
| 515 |
|
|---|
| 516 | * Tidy up redundant duplication.
|
|---|
| 517 | * Fixes a bug where the parser would loop infinitely on universal selectors
|
|---|
| 518 | inside pseudo selectors.
|
|---|
| 519 | * Adds `length` getter and `eachInside`, `map`, `reduce` to the container class.
|
|---|
| 520 | * When a selector has been removed from the tree, the root node will no longer
|
|---|
| 521 | cast it to a string.
|
|---|
| 522 | * Adds node type iterators to the container class (e.g. `eachComment`).
|
|---|
| 523 | * Adds filter function to the container class.
|
|---|
| 524 | * Adds split function to the container class.
|
|---|
| 525 | * Create new node types by doing `parser.id(opts)` etc.
|
|---|
| 526 | * Adds support for pseudo classes anywhere in the selector.
|
|---|
| 527 |
|
|---|
| 528 | # 0.0.3
|
|---|
| 529 |
|
|---|
| 530 | * Adds `next` and `prev` to the node class.
|
|---|
| 531 | * Adds `first` and `last` getters to the container class.
|
|---|
| 532 | * Adds `every` and `some` iterators to the container class.
|
|---|
| 533 | * Add `empty` alias for `removeAll`.
|
|---|
| 534 | * Combinators are now types of node.
|
|---|
| 535 | * Fixes the at method so that it is not an alias for `index`.
|
|---|
| 536 | * Tidy up creation of new nodes in the parser.
|
|---|
| 537 | * Refactors how namespaces are handled for consistency & less redundant code.
|
|---|
| 538 | * Refactors AST to use `nodes` exclusively, and eliminates excessive nesting.
|
|---|
| 539 | * Fixes nested pseudo parsing.
|
|---|
| 540 | * Fixes whitespace parsing.
|
|---|
| 541 |
|
|---|
| 542 | # 0.0.2
|
|---|
| 543 |
|
|---|
| 544 | * Adds support for namespace selectors.
|
|---|
| 545 | * Adds support for selectors joined by escaped spaces - such as `.\31\ 0`.
|
|---|
| 546 |
|
|---|
| 547 | # 0.0.1
|
|---|
| 548 |
|
|---|
| 549 | * Initial release.
|
|---|