Skip to content

Commit 33044f9

Browse files
#fix multiple class include
1 parent 6ee95d9 commit 33044f9

File tree

1 file changed

+16
-11
lines changed
  • astroid/astroid-framework/framework/library/astroid/Component

1 file changed

+16
-11
lines changed

astroid/astroid-framework/framework/library/astroid/Component/LazyLoad.php

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -248,24 +248,29 @@ public static function exclidedViews($views = '')
248248
public static function selectedClasses(&$matches, $classes = '', $toggle = '')
249249
{
250250
$classes = array_map('trim', explode("\n", $classes));
251-
252251
foreach ($matches[0] as $key => $match) {
253-
foreach ($classes as $classname) {
254-
$classExists = preg_match('@class=[\"\'].*' . $classname . '.*[\"\']@Ui', $match);
252+
$classExists = false;
255253

256-
if ($toggle == 'include') {
257-
if (empty($classExists)) {
258-
unset($matches[0][$key]);
259-
unset($matches[1][$key]);
260-
}
261-
262-
continue;
254+
foreach ($classes as $classname) {
255+
$exists = preg_match('@class=[\"\'].*' . $classname . '.*[\"\']@Ui', $match);
256+
if (!empty($exists)) {
257+
$classExists = true;
258+
break;
263259
}
260+
}
264261

265-
if (!empty($classExists)) {
262+
if ($toggle == 'include') {
263+
if (!$classExists) {
266264
unset($matches[0][$key]);
267265
unset($matches[1][$key]);
268266
}
267+
268+
continue;
269+
}
270+
271+
if (!empty($classExists)) {
272+
unset($matches[0][$key]);
273+
unset($matches[1][$key]);
269274
}
270275
}
271276
}

0 commit comments

Comments
 (0)