mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
script: delay Mutation initialization (#35291)
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
This commit is contained in:
parent
503bb10c5b
commit
789736590b
5 changed files with 31 additions and 23 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue