Skip to content

Commit c96e4e3

Browse files
committed
wip
1 parent ce06b52 commit c96e4e3

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

src/Tempest/View/src/Elements/IsElement.php

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,16 @@ public function getAttributes(): array
3434

3535
$attributes = [...$this->attributes, ...$wrappingAttributes];
3636

37-
// Some attributes should always come after others,
38-
// so that these expressions have access to the data attributes
39-
$attributePrecedence = [
40-
':foreach' => 1,
41-
':if' => 2,
42-
];
37+
$tailingAttributes = [];
4338

44-
uksort($attributes, function (string $a, string $b) use ($attributePrecedence) {
45-
$precedenceA = $attributePrecedence[$a] ?? 0;
46-
$precedenceB = $attributePrecedence[$b] ?? 0;
47-
48-
return $precedenceA <=> $precedenceB;
49-
});
39+
foreach ($attributes as $name => $value) {
40+
if ($name === ':foreach' || $name === ':if') {
41+
unset($attributes[$name]);
42+
$tailingAttributes[$name] = $value;
43+
}
44+
}
5045

51-
return $attributes;
46+
return [...$attributes, ...$tailingAttributes];
5247
}
5348

5449
public function hasAttribute(string $name): bool

0 commit comments

Comments
 (0)