Skip to content

Commit 5a18646

Browse files
apply attributes before inserting elements into the DOM (#3892)
1 parent 8390db0 commit 5a18646

File tree

1 file changed

+6
-1
lines changed
  • packages/yew/src/dom_bundle/btag

1 file changed

+6
-1
lines changed

packages/yew/src/dom_bundle/btag/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,16 @@ impl Reconcilable for VTag {
123123
key,
124124
..
125125
} = self;
126-
slot.insert(parent, &el);
127126

127+
// Apply attributes BEFORE inserting the element into the DOM
128+
// This is crucial for SVG animation elements where the animation
129+
// starts immediately upon DOM insertion
128130
let attributes = attributes.apply(root, &el);
129131
let listeners = listeners.apply(root, &el);
130132

133+
// Now insert the element with attributes already set
134+
slot.insert(parent, &el);
135+
131136
let inner = match self.inner {
132137
VTagInner::Input(f) => {
133138
let f = f.apply(root, el.unchecked_ref());

0 commit comments

Comments
 (0)