Add `VTag::into_children`
* Add `VTag::into_children`
Currently, VTag supports `children` and `children_mut`, but not `into_children` to complete the pattern. This is useful if someone wishes to destructively acquire the children of a VTag to reparent them to a different VTag.
* Repair broken doc comment on `VTag::children_mut`
* Remove spaces between functions
@@ -297,7 +297,7 @@ impl VTag {
}
/// Returns a mutable reference to the children of this [VTag], if the node can have
- // children
+ /// children
pub fn children_mut(&mut self) -> Option<&mut VList> {
match &mut self.inner {
VTagInner::Other { children, .. } => Some(children),
@@ -305,6 +305,14 @@ impl VTag {
}
}
+ /// Returns the children of this [VTag]
+ pub fn into_children(self) -> VList {
+ match self.inner {
+ VTagInner::Other { children, .. } => children,
+ _ => VList::new(),
+ }
+ }
+
/// Returns the `value` of an
/// [InputElement](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) or
/// [TextArea](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea)
