mirror of
https://github.com/servo/servo.git
synced 2025-07-30 10:40:27 +01:00
CustomElementRegistry.upgrade works by current spec
This commit is contained in:
parent
45cc558297
commit
065bcee371
4 changed files with 13 additions and 15 deletions
|
@ -448,6 +448,17 @@ impl CustomElementRegistryMethods for CustomElementRegistry {
|
|||
// Step 6
|
||||
promise
|
||||
}
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-customelementregistry-upgrade
|
||||
fn Upgrade(&self, node: &Node) {
|
||||
// Spec says to make a list first and then iterate the list, but
|
||||
// try-to-upgrade only queues upgrade reactions and doesn't itself
|
||||
// modify the tree, so that's not an observable distinction.
|
||||
node.traverse_preorder(ShadowIncluding::Yes).for_each(|n| {
|
||||
if let Some(element) = n.downcast::<Element>() {
|
||||
try_upgrade_element(element);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, JSTraceable, MallocSizeOf)]
|
||||
|
|
|
@ -11,6 +11,8 @@ interface CustomElementRegistry {
|
|||
any get(DOMString name);
|
||||
|
||||
Promise<void> whenDefined(DOMString name);
|
||||
|
||||
[CEReactions] void upgrade(Node root);
|
||||
};
|
||||
|
||||
callback CustomElementConstructor = HTMLElement();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue