diff options
author | Euclid Ye <yezhizhenjiakang@gmail.com> | 2025-02-05 14:28:10 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-05 06:28:10 +0000 |
commit | 789736590b0dd0806bffeb279f9a9bda9ede0dfc (patch) | |
tree | 4a2a1bdcfbbf02347b314a55250e3ba6889b982d /components/script/dom/element.rs | |
parent | 503bb10c5b1fafe01ebfb6b320902be2e8671c69 (diff) | |
download | servo-789736590b0dd0806bffeb279f9a9bda9ede0dfc.tar.gz servo-789736590b0dd0806bffeb279f9a9bda9ede0dfc.zip |
script: delay Mutation initialization (#35291)
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Diffstat (limited to 'components/script/dom/element.rs')
-rw-r--r-- | components/script/dom/element.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 4ed92704d60..24e760d510c 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -5,7 +5,7 @@ //! Element nodes. use std::borrow::Cow; -use std::cell::Cell; +use std::cell::{Cell, LazyCell}; use std::default::Default; use std::ops::Deref; use std::rc::Rc; @@ -1557,11 +1557,11 @@ impl Element { pub(crate) fn push_attribute(&self, attr: &Attr) { let name = attr.local_name().clone(); let namespace = attr.namespace().clone(); - let mutation = Mutation::Attribute { + let mutation = LazyCell::new(|| Mutation::Attribute { name: name.clone(), namespace: namespace.clone(), old_value: None, - }; + }); MutationObserver::queue_a_mutation_record(&self.node, mutation); @@ -1749,11 +1749,11 @@ impl Element { let name = attr.local_name().clone(); let namespace = attr.namespace().clone(); let old_value = DOMString::from(&**attr.value()); - let mutation = Mutation::Attribute { + let mutation = LazyCell::new(|| Mutation::Attribute { name: name.clone(), namespace: namespace.clone(), old_value: Some(old_value.clone()), - }; + }); MutationObserver::queue_a_mutation_record(&self.node, mutation); |