diff --git a/packages/native-core/src/real_dom.rs b/packages/native-core/src/real_dom.rs index 9b8ae1983..490e04dc6 100644 --- a/packages/native-core/src/real_dom.rs +++ b/packages/native-core/src/real_dom.rs @@ -10,7 +10,7 @@ use std::collections::VecDeque; use std::ops::{Deref, DerefMut}; use std::sync::{Arc, RwLock}; -use crate::custom_element::{CustomElementManager, CustomElementRegistry}; +use crate::custom_element::{CustomElement, CustomElementManager, CustomElementRegistry}; use crate::node::{ ElementNode, FromAnyValue, NodeType, OwnedAttributeDiscription, OwnedAttributeValue, TextNode, }; @@ -206,7 +206,7 @@ impl RealDom { if is_element { let custom_elements = self.custom_elements.clone(); custom_elements - .write() + .read() .unwrap() .add_shadow_dom(NodeMut::new(id, self)); } @@ -426,6 +426,11 @@ impl RealDom { pub fn raw_world_mut(&mut self) -> &mut World { &mut self.world } + + /// Registers a new custom element. + pub fn register_custom_element>(&mut self) { + self.custom_elements.write().unwrap().register::() + } } /// A reference to a tracked component in a node.