Skip to content

Commit 1ee43a9

Browse files
committed
The code in the function matches() of class css_rule in cssimport.php was changed:
It did only work by coincidence if the string '$classString' was empty. Now it's expecting such a situation and handles it explicitly.
1 parent cc1552c commit 1ee43a9

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

helper/cssimport.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -946,16 +946,22 @@ public function matches ($element, $classString, $media = NULL) {
946946
$classes = explode (' ', $classString);
947947

948948
foreach ($this->selectors as $selector) {
949-
foreach ($classes as $class) {
950-
if ( $selector [0] == '.' && $selector == '.'.$class ) {
951-
$matches++;
952-
break;
953-
} else {
954-
if ( $selector == $element || $selector == $element.'.'.$class ) {
949+
if ( !empty($classString) ) {
950+
foreach ($classes as $class) {
951+
if ( $selector [0] == '.' && $selector == '.'.$class ) {
955952
$matches++;
956953
break;
954+
} else {
955+
if ( $selector == $element || $selector == $element.'.'.$class ) {
956+
$matches++;
957+
break;
958+
}
957959
}
958960
}
961+
} else {
962+
if ( $selector == $element ) {
963+
$matches++;
964+
}
959965
}
960966
}
961967

0 commit comments

Comments
 (0)