mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01: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
|
@ -2,6 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use std::cell::LazyCell;
|
||||
use std::rc::Rc;
|
||||
|
||||
use dom_struct::dom_struct;
|
||||
|
@ -146,7 +147,12 @@ impl MutationObserver {
|
|||
}
|
||||
|
||||
/// <https://dom.spec.whatwg.org/#queueing-a-mutation-record>
|
||||
pub(crate) fn queue_a_mutation_record(target: &Node, attr_type: Mutation) {
|
||||
pub(crate) fn queue_a_mutation_record<'a, F>(
|
||||
target: &Node,
|
||||
attr_type: LazyCell<Mutation<'a>, F>,
|
||||
) where
|
||||
F: FnOnce() -> Mutation<'a>,
|
||||
{
|
||||
if !target.global().as_window().get_exists_mut_observer() {
|
||||
return;
|
||||
}
|
||||
|
@ -165,7 +171,7 @@ impl MutationObserver {
|
|||
continue;
|
||||
}
|
||||
|
||||
match attr_type {
|
||||
match *attr_type {
|
||||
Mutation::Attribute {
|
||||
ref name,
|
||||
ref namespace,
|
||||
|
@ -239,7 +245,7 @@ impl MutationObserver {
|
|||
// Step 4
|
||||
for (observer, paired_string) in interested_observers {
|
||||
// Steps 4.1-4.7
|
||||
let record = match attr_type {
|
||||
let record = match *attr_type {
|
||||
Mutation::Attribute {
|
||||
ref name,
|
||||
ref namespace,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue