Struct html_sanitizer::Tag[][src]

pub struct Tag<'a> {
    pub name: &'a str,
    pub attrs: &'a [(&'a str, &'a str)],
    // some fields omitted
}

Represents a single HTML node. You can read the name and attrs properties to figure out what tag you're sanitizing.

By default all html nodes will be printed, but attributes will be stripped from a tag unless they are added with allow_attribute and allow_attributes.

Fields

The name of the HTML tag, e.g. 'div', 'img', etc.

The attributes of the HTML tag, e.g. ('style', 'width: 100%').

Methods

impl<'a> Tag<'a>
[src]

Allow the given attribute. This attribute does not have to exist in the attrs tag.

When this HTML node gets printed, this attribute will also get printed.

Allow the given attributes. These attributes do not have to exist in the attrs tag.

When this HTML node gets printed, these attributes will also get printed.

Ignore this tag. This means that the HTML Node will not be printed in the output. In addition, all the child nodes and text content will also not be printed.

Ignore this tag. This means that the HTML Node will not be printed in the output. All child nodes and text content will be printed.

Completely rewrite this tag and all it's children, replacing them by the custom string that is passed to this function.

Auto Trait Implementations

impl<'a> Send for Tag<'a>

impl<'a> Sync for Tag<'a>