Add Element::into_document

It's more convenient in some cases and also makes the example code less
"misleading": Now the string represents a full, correct HTML document.
This commit is contained in:
Joscha 2024-12-02 21:48:46 +01:00
parent b377ee2936
commit 6f0ae129fa
4 changed files with 20 additions and 10 deletions

View file

@ -239,6 +239,14 @@ impl Element {
self.add(c);
self
}
/// Convert this element into a [`Document`].
///
/// This function is equivalent to calling `self.into()` but may be more
/// convenient in some cases.
pub fn into_document(self) -> Document {
self.into()
}
}
/// A component can add itself to an [`Element`] by modifying it.