← All changes
|
back/Libraries/Sabberworm/CSS/src/Property/KeyframeSelector.php
+38
-14
10.2.2
→
11.1.0
View file →
| @@ -1,23 +1,47 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -namespace Sabberworm\CSS\Property; | |
| 3 | +declare(strict_types=1); | |
| 4 | 4 | |
| 5 | +namespace AcyMailing\Libraries\Sabberworm\CSS\Property; | |
| 6 | + | |
| 5 | 7 | class KeyframeSelector extends Selector |
| 6 | 8 | { |
| 7 | 9 | /** |
| 8 | - * regexp for specificity calculations | |
| 10 | + * This differs from the parent class: | |
| 11 | + * - comma is not allowed unless escaped or quoted; | |
| 12 | + * - percentage value is allowed by itself. | |
| 9 | 13 | * |
| 10 | - * @var string | |
| 14 | + * @var non-empty-string | |
| 15 | + * | |
| 16 | + * @internal since 8.5.2 | |
| 11 | 17 | */ |
| 12 | - const SELECTOR_VALIDATION_RX = '/ | |
| 13 | - ^( | |
| 14 | - (?: | |
| 15 | - [a-zA-Z0-9\x{00A0}-\x{FFFF}_^$|*="\'~\[\]()\-\s\.:#+>]* # any sequence of valid unescaped characters | |
| 16 | - (?:\\\\.)? # a single escaped character | |
| 17 | - (?:([\'"]).*?(?<!\\\\)\2)? # a quoted text like [id="example"] | |
| 18 | - )* | |
| 19 | - )| | |
| 20 | - (\d+%) # keyframe animation progress percentage (e.g. 50%) | |
| 21 | - $ | |
| 22 | - /ux'; | |
| 18 | + public const SELECTOR_VALIDATION_RX = '/ | |
| 19 | + ^( | |
| 20 | + (?: | |
| 21 | + # any sequence of valid unescaped characters, except quotes | |
| 22 | + [a-zA-Z0-9\\x{00A0}-\\x{FFFF}_^$|*=~\\[\\]()\\-\\s\\.:#+>]++ | |
| 23 | + | | |
| 24 | + # one or more escaped characters | |
| 25 | + (?:\\\\.)++ | |
| 26 | + | | |
| 27 | + # quoted text, like in `[id="example"]` | |
| 28 | + (?: | |
| 29 | + # opening quote | |
| 30 | + ([\'"]) | |
| 31 | + (?: | |
| 32 | + # sequence of characters except closing quote or backslash | |
| 33 | + (?:(?!\\g{-1}|\\\\).)++ | |
| 34 | + | | |
| 35 | + # one or more escaped characters | |
| 36 | + (?:\\\\.)++ | |
| 37 | + )*+ # zero or more times | |
| 38 | + # closing quote or end (unmatched quote is currently allowed) | |
| 39 | + (?:\\g{-1}|$) | |
| 40 | + ) | |
| 41 | + )*+ # zero or more times | |
| 42 | + | | |
| 43 | + # keyframe animation progress percentage (e.g. 50%), untrimmed | |
| 44 | + \\s*+(\\d++%)\\s*+ | |
| 45 | + )$ | |
| 46 | + /ux'; | |
| 23 | 47 | } |