diff --git a/src/Element/Element.php b/src/Element/Element.php index cfb0255..ccb0cdd 100644 --- a/src/Element/Element.php +++ b/src/Element/Element.php @@ -138,10 +138,9 @@ public function attributes(): array */ public function withAttributes(array $attributes = []): static { - $this->attributes = array_merge( - $this->attributes, - $attributes - ); + foreach ($attributes as $key => $value) { + $this->withAttribute($key, $value); + } return $this; }