fn remove(&mut self, id: usize) -> Option<Node<S>> {
        // We do not need to remove the node from the parent's children list for children.
        fn inner<S: State>(dom: &mut RealDom<S>, id: usize) -> Option<Node<S>> {
            let mut node = dom.nodes[id as usize].take()?;
            if let NodeType::Element { children, .. } = &mut node.node_type {
                for c in children {
                    inner(dom, c.0)?;
                }
            }
            Some(node)
        }
        let mut node = self.nodes[id as usize].take()?;
        if let Some(parent) = node.parent {
            let parent = &mut self[parent];
            parent.remove_child(ElementId(id));
        }
        if let NodeType::Element { children, .. } = &mut node.node_type {
            for c in children {
                inner(self, c.0)?;
            }
        }
        Some(node)
    }
// remove a node and it's children from the dom.
remove a node and it's children from the dom.
remove a node and it ' s children from the dom .
fn remove(&mut self, id: usize) -> Option<Node<S>> {
        // We do not need to remove the node from the parent's children list for children.
        fn inner<S: State>(dom: &mut RealDom<S>, id: usize) -> Option<Node<S>> {
            let mut node = dom.nodes[id as usize].take()?;
            if let NodeType::Element { children, .. } = &mut node.node_type {
                for c in children {
                    inner(dom, c.0)?;
                }
            }
            Some(node)
        }
        let mut node = self.nodes[id as usize].take()?;
        if let Some(parent) = node.parent {
            let parent = &mut self[parent];
            parent.remove_child(ElementId(id));
        }
        if let NodeType::Element { children, .. } = &mut node.node_type {
            for c in children {
                inner(self, c.0)?;
            }
        }
        Some(node)
    }
fn remove ( & mut self , id : usize ) -> Option < Node < S > > { // We do not need to remove the node from the parent's children list for children. fn inner < S : State > ( dom : & mut RealDom < S > , id : usize ) -> Option < Node < S > > { let mut node = dom . nodes [ id as usize ] . take ( ) ? ; if let NodeType :: Element { children , .. } = & mut node . node_type { for c in children { inner ( dom , c . 0 ) ? ; } } Some ( node ) } let mut node = self . nodes [ id as usize ] . take ( ) ? ; if let Some ( parent ) = node . parent { let parent = & mut self [ parent ] ; parent . remove_child ( ElementId ( id ) ) ; } if let NodeType :: Element { children , .. } = & mut node . node_type { for c in children { inner ( self , c . 0 ) ? ; } } Some ( node ) }
remove a node and it's children from the dom.
remove a node and it ' s children from the dom .
&mut self
id
usize
&mut self
id
usize