textlane-html 0.6.0

Textlane's HTML plugins: parsing, transforms, sanitizing and serializing
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use textlane_core::hast::Element;

use crate::helpers::property::find_property;
use crate::helpers::schema::HTML;

/// Remove an attribute by its HTML name; whether one was set.
pub fn remove_attribute(element: &mut Element<'_>, name: &str) -> bool {
    let found = find_property(&HTML, name);
    let before = element.properties.len();
    element
        .properties
        .retain(|property| property.name != found.property);
    element.properties.len() != before
}