mirror of
https://github.com/yewstack/yew.git
synced 2025-12-08 21:26:25 +00:00
Add VTag::into_children (#2638)
* 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
This commit is contained in:
parent
1794dd01bc
commit
2db4c81ad6
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user