pub fn duplicate(self, gc_context: MutationContext<'gc, '_>, deep: bool) -> XmlNode<'gc> {
        let mut clone = XmlNode(GcCell::allocate(
            gc_context,
            match &*self.0.read() {
                XmlNodeData::DocumentRoot { .. } => XmlNodeData::DocumentRoot {
                    script_object: None,
                    attributes_script_object: None,
                    children: Vec::new(),
                },
                XmlNodeData::Element {
                    tag_name,
                    attributes,
                    ..
                } => XmlNodeData::Element {
                    script_object: None,
                    parent: None,
                    prev_sibling: None,
                    next_sibling: None,
                    tag_name: *tag_name,
                    attributes: attributes.clone(),
                    attributes_script_object: None,
                    children: Vec::new(),
                },
                XmlNodeData::Text { contents, .. } => XmlNodeData::Text {
                    script_object: None,
                    attributes_script_object: None,
                    parent: None,
                    prev_sibling: None,
                    next_sibling: None,
                    contents: *contents,
                },
            },
        ));

        if deep {
            for (position, child) in self.children().enumerate() {
                clone.insert_child(gc_context, position, child.duplicate(gc_context, deep));
            }
        }

        clone
    }
/// Create a duplicate copy of this node.
///
/// If the `deep` flag is set true, then the entire node tree will be
/// cloned.
Create a duplicate copy of this node.
If the `deep` flag is set true, then the entire node tree will be
cloned.
Create a duplicate copy of this node . If the ` deep ` flag is set true then the entire node tree will be cloned .
pub fn duplicate(self, gc_context: MutationContext<'gc, '_>, deep: bool) -> XmlNode<'gc> {
        let mut clone = XmlNode(GcCell::allocate(
            gc_context,
            match &*self.0.read() {
                XmlNodeData::DocumentRoot { .. } => XmlNodeData::DocumentRoot {
                    script_object: None,
                    attributes_script_object: None,
                    children: Vec::new(),
                },
                XmlNodeData::Element {
                    tag_name,
                    attributes,
                    ..
                } => XmlNodeData::Element {
                    script_object: None,
                    parent: None,
                    prev_sibling: None,
                    next_sibling: None,
                    tag_name: *tag_name,
                    attributes: attributes.clone(),
                    attributes_script_object: None,
                    children: Vec::new(),
                },
                XmlNodeData::Text { contents, .. } => XmlNodeData::Text {
                    script_object: None,
                    attributes_script_object: None,
                    parent: None,
                    prev_sibling: None,
                    next_sibling: None,
                    contents: *contents,
                },
            },
        ));
        if deep {
            for (position, child) in self.children().enumerate() {
                clone.insert_child(gc_context, position, child.duplicate(gc_context, deep));
            }
        }
        clone
    }
pub fn duplicate ( self , gc_context : MutationContext < ' gc , ' _ > , deep : bool ) -> XmlNode < ' gc > { let mut clone = XmlNode ( GcCell :: allocate ( gc_context , match & * self . 0 . read ( ) { XmlNodeData :: DocumentRoot { .. } => XmlNodeData :: DocumentRoot { script_object : None , attributes_script_object : None , children : Vec :: new ( ) , } , XmlNodeData :: Element { tag_name , attributes , .. } => XmlNodeData :: Element { script_object : None , parent : None , prev_sibling : None , next_sibling : None , tag_name : * tag_name , attributes : attributes . clone ( ) , attributes_script_object : None , children : Vec :: new ( ) , } , XmlNodeData :: Text { contents , .. } => XmlNodeData :: Text { script_object : None , attributes_script_object : None , parent : None , prev_sibling : None , next_sibling : None , contents : * contents , } , } , ) ) ; if deep { for ( position , child ) in self . children ( ) . enumerate ( ) { clone . insert_child ( gc_context , position , child . duplicate ( gc_context , deep ) ) ; } } clone }
Create a duplicate copy of this node.
Create a duplicate copy of this node .
self
gc_context
MutationContext<'gc, '_>
deep
bool