node: add ability to remove attributes

This commit is contained in:
Matt Bilker
2019-08-30 07:04:25 +00:00
parent 8135163a02
commit 3edc7026e4

View File

@@ -199,6 +199,10 @@ impl Node {
attributes.insert(key.into(), value.into())
}
pub fn remove_attr(&mut self, key: &str) -> Option<String> {
self.attributes.as_mut().and_then(|attributes| attributes.remove(key))
}
pub fn sort_attrs(&mut self) {
if let Some(ref mut attributes) = self.attributes {
attributes.sort_keys();