| 1 |
# Changelog |
| 2 |
|
| 3 |
All notable changes to this project will be documented in this file. |
| 4 |
This project adheres to [](https://semver.org/Semantic Versioning](https://semver.org/](https://semver.org/). |
| 5 |
|
| 6 |
## x.y.z |
| 7 |
|
| 8 |
### Added |
| 9 |
|
| 10 |
### Changed |
| 11 |
|
| 12 |
### Deprecated |
| 13 |
|
| 14 |
### Removed |
| 15 |
|
| 16 |
### Fixed |
| 17 |
|
| 18 |
## 8.9.0: New features, bug fixes and deprecations |
| 19 |
|
| 20 |
### Added |
| 21 |
|
| 22 |
- `RuleSet::removeMatchingRules()` method |
| 23 |
(for the implementing classes `AtRuleSet` and `DeclarationBlock`) (#1249) |
| 24 |
- `RuleSet::removeAllRules()` method |
| 25 |
(for the implementing classes `AtRuleSet` and `DeclarationBlock`) (#1249) |
| 26 |
- Add Interface `CSSElement` (#1231) |
| 27 |
- Methods `getLineNumber` and `getColumnNumber` which return a nullable `int` |
| 28 |
for the following classes: |
| 29 |
`Comment`, `CSSList`, `SourceException`, `Charset`, `CSSNamespace`, `Import`, |
| 30 |
`Rule`, `DeclarationBlock`, `RuleSet`, `CSSFunction`, `Value` (#1225, #1263) |
| 31 |
- `Positionable` interface for CSS items that may have a position |
| 32 |
(line and perhaps column number) in the parsed CSS (#1221) |
| 33 |
|
| 34 |
### Changed |
| 35 |
|
| 36 |
- Parameters for `getAllValues()` are deconflated, so it now takes three (all |
| 37 |
optional), allowing `$element` and `$ruleSearchPattern` to be specified |
| 38 |
separately (#1241) |
| 39 |
- Implement `Positionable` in the following CSS item classes: |
| 40 |
`Comment`, `CSSList`, `SourceException`, `Charset`, `CSSNamespace`, `Import`, |
| 41 |
`Rule`, `DeclarationBlock`, `RuleSet`, `CSSFunction`, `Value` (#1225) |
| 42 |
|
| 43 |
### Deprecated |
| 44 |
|
| 45 |
- Support for PHP < 7.2 is deprecated; version 9.0 will require PHP 7.2 or later |
| 46 |
(#1264) |
| 47 |
- Passing a `string` or `null` to `RuleSet::removeRule()` is deprecated |
| 48 |
(implementing classes are `AtRuleSet` and `DeclarationBlock`); |
| 49 |
use `removeMatchingRules()` or `removeAllRules()` instead (#1249) |
| 50 |
- Passing a `Rule` to `RuleSet::getRules()` or `getRulesAssoc()` is deprecated, |
| 51 |
affecting the implementing classes `AtRuleSet` and `DeclarationBlock` |
| 52 |
(call e.g. `getRules($rule->getRule())` instead) (#1248) |
| 53 |
- Passing a string as the first argument to `getAllValues()` is deprecated; |
| 54 |
the search pattern should now be passed as the second argument (#1241) |
| 55 |
- Passing a Boolean as the second argument to `getAllValues()` is deprecated; |
| 56 |
the flag for searching in function arguments should now be passed as the third |
| 57 |
argument (#1241) |
| 58 |
- `getLineNo()` is deprecated in these classes (use `getLineNumber()` instead): |
| 59 |
`Comment`, `CSSList`, `SourceException`, `Charset`, `CSSNamespace`, `Import`, |
| 60 |
`Rule`, `DeclarationBlock`, `RuleSet`, `CSSFunction`, `Value` (#1225, #1233) |
| 61 |
- `Rule::getColNo()` is deprecated (use `getColumnNumber()` instead) |
| 62 |
(#1225, #1233) |
| 63 |
- Providing zero as the line number argument to `Rule::setPosition()` is |
| 64 |
deprecated (pass `null` instead if there is no line number) (#1225, #1233) |
| 65 |
|
| 66 |
### Fixed |
| 67 |
|
| 68 |
- Set line number when `RuleSet::addRule()` called with only column number set |
| 69 |
(#1265) |
| 70 |
- Ensure first rule added with `RuleSet::addRule()` has valid position (#1262) |
| 71 |
|
| 72 |
## 8.8.0: Bug fixes and deprecations |
| 73 |
|
| 74 |
### Added |
| 75 |
|
| 76 |
- `OutputFormat` properties for space around specific list separators (#880) |
| 77 |
|
| 78 |
### Changed |
| 79 |
|
| 80 |
- Mark the `OutputFormat` constructor as `@internal` (#1131) |
| 81 |
- Mark `OutputFormatter` as `@internal` (#896) |
| 82 |
- Mark `Selector::isValid()` as `@internal` (#1037) |
| 83 |
- Mark parsing-related methods of most CSS elements as `@internal` (#908) |
| 84 |
- Mark `OutputFormat::nextLevel()` as `@internal` (#901) |
| 85 |
- Make all non-private properties `@internal` (#886) |
| 86 |
|
| 87 |
### Deprecated |
| 88 |
|
| 89 |
- Deprecate extending `OutputFormat` (#1131) |
| 90 |
- Deprecate `OutputFormat::get()` and `::set()` (#1107) |
| 91 |
- Deprecate support for `-webkit-calc` and `-moz-calc` (#1086) |
| 92 |
- Deprecate magic method forwarding from `OutputFormat` to `OutputFormatter` |
| 93 |
(#894) |
| 94 |
- Deprecate `__toString()` (#1006) |
| 95 |
- Deprecate greedy calculation of selector specificity (#1018) |
| 96 |
- Deprecate the IE hack in `Rule` (#993, #1003) |
| 97 |
- `OutputFormat` properties for space around list separators as an array (#880) |
| 98 |
- Deprecate `OutputFormat::level()` (#870) |
| 99 |
|
| 100 |
### Fixed |
| 101 |
|
| 102 |
- Include comments for all rules in declaration block (#1169) |
| 103 |
- Render rules in line and column number order (#1059) |
| 104 |
- Create `Size` with correct types in `expandBackgroundShorthand` (#814) |
| 105 |
- Parse `@font-face` `src` property as comma-delimited list (#794) |
| 106 |
|
| 107 |
## 8.7.0: Add support for PHP 8.4 |
| 108 |
|
| 109 |
### Added |
| 110 |
|
| 111 |
- Add support for PHP 8.4 (#675, #701, #746, #751) |
| 112 |
|
| 113 |
### Changed |
| 114 |
|
| 115 |
- Mark parsing-internal classes and methods as `@internal` (#711) |
| 116 |
- Block installations on unsupported higher PHP versions (#691) |
| 117 |
|
| 118 |
### Deprecated |
| 119 |
|
| 120 |
- Deprecate the expansion of shorthand properties (#719) |
| 121 |
- Deprecate `Parser::setCharset()` and `Parser::getCharset()` (#703) |
| 122 |
|
| 123 |
### Fixed |
| 124 |
|
| 125 |
- Fix type errors in PHP strict mode (#695) |
| 126 |
|
| 127 |
## 8.6.0 |
| 128 |
|
| 129 |
### Added |
| 130 |
|
| 131 |
- Support arithmetic operators in CSS function arguments (#607) |
| 132 |
- Add support for inserting an item in a CSS list (#545) |
| 133 |
- Add support for the `dvh`, `lvh` and `svh` length units (#415) |
| 134 |
|
| 135 |
### Changed |
| 136 |
|
| 137 |
- Improve performance of Value::parseValue with many delimiters by refactoring |
| 138 |
to remove `array_search()` (#413) |
| 139 |
|
| 140 |
## 8.5.2 |
| 141 |
|
| 142 |
### Changed |
| 143 |
|
| 144 |
- Mark all class constants as `@internal` (#500) |
| 145 |
|
| 146 |
### Fixed |
| 147 |
|
| 148 |
- Fix undefined local variable in `CalcFunction::parse()` (#593) |
| 149 |
|
| 150 |
## 8.5.1 |
| 151 |
|
| 152 |
### Fixed |
| 153 |
|
| 154 |
- Fix PHP notice caused by parsing invalid color values having less than |
| 155 |
6 characters (#485) |
| 156 |
- Fix (regression) failure to parse at-rules with strict parsing (#456) |
| 157 |
|
| 158 |
## 8.5.0 |
| 159 |
|
| 160 |
### Added |
| 161 |
|
| 162 |
- Add a method to get an import's media queries (#384) |
| 163 |
- Add more unit tests (#381, #382) |
| 164 |
|
| 165 |
### Fixed |
| 166 |
|
| 167 |
- Retain CSSList and Rule comments when rendering CSS (#351) |
| 168 |
- Replace invalid `turns` unit with `turn` (#350) |
| 169 |
- Also allow string values for rules (#348) |
| 170 |
- Fix invalid calc parsing (#169) |
| 171 |
- Handle scientific notation when parsing sizes (#179) |
| 172 |
- Fix PHP 8.1 compatibility in `ParserState::strsplit()` (#344) |
| 173 |
|
| 174 |
## 8.4.0 |
| 175 |
|
| 176 |
### Features |
| 177 |
|
| 178 |
* Support for PHP 8.x |
| 179 |
* PHPDoc annotations |
| 180 |
* Allow usage of CSS variables inside color functions (by parsing them as |
| 181 |
regular functions) |
| 182 |
* Use PSR-12 code style |
| 183 |
* *No deprecations* |
| 184 |
|
| 185 |
### Bugfixes |
| 186 |
|
| 187 |
* Improved handling of whitespace in `calc()` |
| 188 |
* Fix parsing units whose prefix is also a valid unit, like `vmin` |
| 189 |
* Allow passing an object to `CSSList#replace` |
| 190 |
* Fix PHP 7.3 warnings |
| 191 |
* Correctly parse keyframes with `%` |
| 192 |
* Don’t convert large numbers to scientific notation |
| 193 |
* Allow a file to end after an `@import` |
| 194 |
* Preserve case of CSS variables as specced |
| 195 |
* Allow identifiers to use escapes the same way as strings |
| 196 |
* No longer use `eval` for the comparison in `getSelectorsBySpecificity`, in |
| 197 |
case it gets passed untrusted input (CVE-2020-13756). Also fixed in 8.3.1, |
| 198 |
8.2.1, 8.1.1, 8.0.1, 7.0.4, 6.0.2, 5.2.1, 5.1.3, 5.0.9, 4.0.1, 3.0.1, 2.0.1, |
| 199 |
1.0.1. |
| 200 |
* Prevent an infinite loop when parsing invalid grid line names |
| 201 |
* Remove invalid unit `vm` |
| 202 |
* Retain rule order after expanding shorthands |
| 203 |
|
| 204 |
### Backwards-incompatible changes |
| 205 |
|
| 206 |
* PHP ≥ 5.6 is now required |
| 207 |
* HHVM compatibility target dropped |
| 208 |
|
| 209 |
## 8.3.0 (2019-02-22) |
| 210 |
|
| 211 |
* Refactor parsing logic to mostly reside in the class files whose data |
| 212 |
structure is to be parsed (this should eventually allow us to unit-test |
| 213 |
specific parts of the parsing logic individually). |
| 214 |
* Fix error in parsing `calc` expessions when the first operand is a negative |
| 215 |
number, thanks to @raxbg. |
| 216 |
* Support parsing CSS4 colors in hex notation with alpha values, thanks to |
| 217 |
@raxbg. |
| 218 |
* Swallow more errors in lenient mode, thanks to @raxbg. |
| 219 |
* Allow specifying arbitrary strings to output before and after declaration |
| 220 |
blocks, thanks to @westonruter. |
| 221 |
* *No backwards-incompatible changes* |
| 222 |
* *No deprecations* |
| 223 |
|
| 224 |
## 8.2.0 (2018-07-13) |
| 225 |
|
| 226 |
* Support parsing `calc()`, thanks to @raxbg. |
| 227 |
* Support parsing grid-lines, again thanks to @raxbg. |
| 228 |
* Support parsing legacy IE filters (`progid:`) in lenient mode, thanks to |
| 229 |
@FMCorz |
| 230 |
* Performance improvements parsing large files, again thanks to @FMCorz |
| 231 |
* *No backwards-incompatible changes* |
| 232 |
* *No deprecations* |
| 233 |
|
| 234 |
## 8.1.0 (2016-07-19) |
| 235 |
|
| 236 |
* Comments are no longer silently ignored but stored with the object with which |
| 237 |
they appear (no render support, though). Thanks to @FMCorz. |
| 238 |
* The IE hacks using `\0` and `\9` can now be parsed (and rendered) in lenient |
| 239 |
mode. Thanks (again) to @FMCorz. |
| 240 |
* Media queries with or without spaces before the query are parsed. Still no |
| 241 |
*real* parsing support, though. Sorry… |
| 242 |
* PHPUnit is now listed as a dev-dependency in composer.json. |
| 243 |
* *No backwards-incompatible changes* |
| 244 |
* *No deprecations* |
| 245 |
|
| 246 |
## 8.0.0 (2016-06-30) |
| 247 |
|
| 248 |
* Store source CSS line numbers in tokens and parsing exceptions. |
| 249 |
* *No deprecations* |
| 250 |
|
| 251 |
### Backwards-incompatible changes |
| 252 |
|
| 253 |
* Unrecoverable parser errors throw an exception of type |
| 254 |
`Sabberworm\CSS\Parsing\SourceException` instead of `\Exception`. |
| 255 |
|
| 256 |
## 7.0.3 (2016-04-27) |
| 257 |
|
| 258 |
* Fixed parsing empty CSS when multibyte is off |
| 259 |
* *No backwards-incompatible changes* |
| 260 |
* *No deprecations* |
| 261 |
|
| 262 |
## 7.0.2 (2016-02-11) |
| 263 |
|
| 264 |
* 150 time performance boost thanks |
| 265 |
to @[](https://github.com/ossinkineossinkine](https://github.com/ossinkine](https://github.com/ossinkine) |
| 266 |
* *No backwards-incompatible changes* |
| 267 |
* *No deprecations* |
| 268 |
|
| 269 |
## 7.0.1 (2015-12-25) |
| 270 |
|
| 271 |
* No more suppressed `E_NOTICE` |
| 272 |
* *No backwards-incompatible changes* |
| 273 |
* *No deprecations* |
| 274 |
|
| 275 |
## 7.0.0 (2015-08-24) |
| 276 |
|
| 277 |
* Compatibility with PHP 7. Well timed, eh? |
| 278 |
* *No deprecations* |
| 279 |
|
| 280 |
### Backwards-incompatible changes |
| 281 |
|
| 282 |
* The `Sabberworm\CSS\Value\String` class has been renamed to |
| 283 |
`Sabberworm\CSS\Value\CSSString`. |
| 284 |
|
| 285 |
## 6.0.1 (2015-08-24) |
| 286 |
|
| 287 |
* Remove some declarations in interfaces incompatible with PHP 5.3 (< 5.3.9) |
| 288 |
* *No deprecations* |
| 289 |
|
| 290 |
## 6.0.0 (2014-07-03) |
| 291 |
|
| 292 |
* Format output using Sabberworm\CSS\OutputFormat |
| 293 |
* *No backwards-incompatible changes* |
| 294 |
|
| 295 |
### Deprecations |
| 296 |
|
| 297 |
* The parse() method replaces __toString with an optional argument (instance of |
| 298 |
the OutputFormat class) |
| 299 |
|
| 300 |
## 5.2.0 (2014-06-30) |
| 301 |
|
| 302 |
* Support removing a selector from a declaration block using |
| 303 |
`$oBlock->removeSelector($mSelector)` |
| 304 |
* Introduce a specialized exception (Sabberworm\CSS\Parsing\OuputException) for |
| 305 |
exceptions during output rendering |
| 306 |
|
| 307 |
* *No deprecations* |
| 308 |
|
| 309 |
#### Backwards-incompatible changes |
| 310 |
|
| 311 |
* Outputting a declaration block that has no selectors throws an OuputException |
| 312 |
instead of outputting an invalid ` {…}` into the CSS document. |
| 313 |
|
| 314 |
## 5.1.2 (2013-10-30) |
| 315 |
|
| 316 |
* Remove the use of consumeUntil in comment parsing. This makes it possible to |
| 317 |
parse comments such as `/** Perfectly valid **/` |
| 318 |
* Add fr relative size unit |
| 319 |
* Fix some issues with HHVM |
| 320 |
* *No backwards-incompatible changes* |
| 321 |
* *No deprecations* |
| 322 |
|
| 323 |
## 5.1.1 (2013-10-28) |
| 324 |
|
| 325 |
* Updated CHANGELOG.md to reflect changes since 5.0.4 |
| 326 |
* *No backwards-incompatible changes* |
| 327 |
* *No deprecations* |
| 328 |
|
| 329 |
## 5.1.0 (2013-10-24) |
| 330 |
|
| 331 |
* Performance enhancements by Michael M Slusarz |
| 332 |
* More rescue entry points for lenient parsing (unexpected tokens between |
| 333 |
declaration blocks and unclosed comments) |
| 334 |
* *No backwards-incompatible changes* |
| 335 |
* *No deprecations* |
| 336 |
|
| 337 |
## 5.0.8 (2013-08-15) |
| 338 |
|
| 339 |
* Make default settings’ multibyte parsing option dependent on whether or not |
| 340 |
the mbstring extension is actually installed. |
| 341 |
* *No backwards-incompatible changes* |
| 342 |
* *No deprecations* |
| 343 |
|
| 344 |
## 5.0.7 (2013-08-04) |
| 345 |
|
| 346 |
* Fix broken decimal point output optimization |
| 347 |
* *No backwards-incompatible changes* |
| 348 |
* *No deprecations* |
| 349 |
|
| 350 |
## 5.0.6 (2013-05-31) |
| 351 |
|
| 352 |
* Fix broken unit test |
| 353 |
* *No backwards-incompatible changes* |
| 354 |
* *No deprecations* |
| 355 |
|
| 356 |
## 5.0.5 (2013-04-17) |
| 357 |
|
| 358 |
* Initial support for lenient parsing (setting this parser option will catch |
| 359 |
some exceptions internally and recover the parser’s state as neatly as |
| 360 |
possible). |
| 361 |
* *No backwards-incompatible changes* |
| 362 |
* *No deprecations* |
| 363 |
|
| 364 |
## 5.0.4 (2013-03-21) |
| 365 |
|
| 366 |
* Don’t output floats with locale-aware separator chars |
| 367 |
* *No backwards-incompatible changes* |
| 368 |
* *No deprecations* |
| 369 |
|
| 370 |
## 5.0.3 (2013-03-21) |
| 371 |
|
| 372 |
* More size units recognized |
| 373 |
* *No backwards-incompatible changes* |
| 374 |
* *No deprecations* |
| 375 |
|
| 376 |
## 5.0.2 (2013-03-21) |
| 377 |
|
| 378 |
* CHANGELOG.md file added to distribution |
| 379 |
* *No backwards-incompatible changes* |
| 380 |
* *No deprecations* |
| 381 |
|
| 382 |
## 5.0.1 (2013-03-20) |
| 383 |
|
| 384 |
* Internal cleanup |
| 385 |
* *No backwards-incompatible changes* |
| 386 |
* *No deprecations* |
| 387 |
|
| 388 |
## 5.0.0 (2013-03-20) |
| 389 |
|
| 390 |
* Correctly parse all known CSS 3 units (including Hz and kHz). |
| 391 |
* Output RGB colors in short (#aaa or #ababab) notation |
| 392 |
* Be case-insensitive when parsing identifiers. |
| 393 |
* *No deprecations* |
| 394 |
|
| 395 |
### Backwards-incompatible changes |
| 396 |
|
| 397 |
* `Sabberworm\CSS\Value\Color`’s `__toString` method overrides `CSSList`’s to |
| 398 |
maybe return something other than `type(value, …)` (see above). |
| 399 |
|
| 400 |
## 4.0.0 (2013-03-19) |
| 401 |
|
| 402 |
* Support for more @-rules |
| 403 |
* Generic interface `Sabberworm\CSS\Property\AtRule`, implemented by all @-rule |
| 404 |
classes |
| 405 |
* *No deprecations* |
| 406 |
|
| 407 |
### Backwards-incompatible changes |
| 408 |
|
| 409 |
* `Sabberworm\CSS\RuleSet\AtRule` renamed to `Sabberworm\CSS\RuleSet\AtRuleSet` |
| 410 |
* `Sabberworm\CSS\CSSList\MediaQuery` renamed to |
| 411 |
`Sabberworm\CSS\RuleSet\CSSList\AtRuleBlockList` with differing semantics and |
| 412 |
API (which also works for other block-list-based @-rules like `@supports`). |
| 413 |
|
| 414 |
## 3.0.0 (2013-03-06) |
| 415 |
|
| 416 |
* Support for lenient parsing (on by default) |
| 417 |
* *No deprecations* |
| 418 |
|
| 419 |
### Backwards-incompatible changes |
| 420 |
|
| 421 |
* All properties (like whether or not to use `mb_`-functions, which default |
| 422 |
charset to use and – new – whether or not to be forgiving when parsing) are |
| 423 |
now encapsulated in an instance of `Sabberworm\CSS\Settings` which can be |
| 424 |
passed as the second argument to `Sabberworm\CSS\Parser->__construct()`. |
| 425 |
* Specifying a charset as the second argument to |
| 426 |
`Sabberworm\CSS\Parser->__construct()` is no longer supported. Use |
| 427 |
`Sabberworm\CSS\Settings::create()->withDefaultCharset('some-charset')` |
| 428 |
instead. |
| 429 |
* Setting `Sabberworm\CSS\Parser->bUseMbFunctions` has no effect. Use |
| 430 |
`Sabberworm\CSS\Settings::create()->withMultibyteSupport(true/false)` instead. |
| 431 |
* `Sabberworm\CSS\Parser->parse()` may throw a |
| 432 |
`Sabberworm\CSS\Parsing\UnexpectedTokenException` when in strict parsing mode. |
| 433 |
|
| 434 |
## 2.0.0 (2013-01-29) |
| 435 |
|
| 436 |
* Allow multiple rules of the same type per rule set |
| 437 |
|
| 438 |
### Backwards-incompatible changes |
| 439 |
|
| 440 |
* `Sabberworm\CSS\RuleSet->getRules()` returns an index-based array instead of |
| 441 |
an associative array. Use `Sabberworm\CSS\RuleSet->getRulesAssoc()` (which |
| 442 |
eliminates duplicate rules and lets the later rule of the same name win). |
| 443 |
* `Sabberworm\CSS\RuleSet->removeRule()` works as it did before except when |
| 444 |
passed an instance of `Sabberworm\CSS\Rule\Rule`, in which case it would only |
| 445 |
remove the exact rule given instead of all the rules of the same type. To get |
| 446 |
the old behaviour, use `Sabberworm\CSS\RuleSet->removeRule($oRule->getRule()`; |
| 447 |
|
| 448 |
## 1.0 |
| 449 |
|
| 450 |
Initial release of a stable public API. |
| 451 |
|
| 452 |
## 0.9 |
| 453 |
|
| 454 |
Last version not to use PSR-0 project organization semantics. |
| 455 |
|