Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Please also have a look at our

### Fixed

- Use typesafe versions of PHP functions (#1379, #1380, #1382, #1383)
- Use typesafe versions of PHP functions (#1379, #1380, #1382, #1383, #1384)

### Documentation

Expand Down
6 changes: 4 additions & 2 deletions src/Property/Selector/SpecificityCalculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace Sabberworm\CSS\Property\Selector;

use function Safe\preg_match_all;

/**
* Utility class to calculate the specificity of a CSS selector.
*
Expand Down Expand Up @@ -67,8 +69,8 @@ public static function calculate(string $selector): int
/// @todo should exclude \# as well as "#"
$matches = null;
$b = \substr_count($selector, '#');
$c = \preg_match_all(self::NON_ID_ATTRIBUTES_AND_PSEUDO_CLASSES_RX, $selector, $matches);
$d = \preg_match_all(self::ELEMENTS_AND_PSEUDO_ELEMENTS_RX, $selector, $matches);
$c = preg_match_all(self::NON_ID_ATTRIBUTES_AND_PSEUDO_CLASSES_RX, $selector, $matches);
$d = preg_match_all(self::ELEMENTS_AND_PSEUDO_ELEMENTS_RX, $selector, $matches);
self::$cache[$selector] = ($a * 1000) + ($b * 100) + ($c * 10) + $d;
}

Expand Down