apply attributes before inserting elements into the DOM (#3892)

This commit is contained in:
Siyuan Yan 2025-08-12 21:03:57 +09:00 committed by GitHub
parent 8390db0c07
commit 5a1864643f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -123,11 +123,16 @@ impl Reconcilable for VTag {
key,
..
} = self;
slot.insert(parent, &el);
// Apply attributes BEFORE inserting the element into the DOM
// This is crucial for SVG animation elements where the animation
// starts immediately upon DOM insertion
let attributes = attributes.apply(root, &el);
let listeners = listeners.apply(root, &el);
// Now insert the element with attributes already set
slot.insert(parent, &el);
let inner = match self.inner {
VTagInner::Input(f) => {
let f = f.apply(root, el.unchecked_ref());