`.
///
/// The namespace on the attribute name is almost always ns!("").
/// The tokenizer creates all attributes this way, but the tree
/// builder will adjust certain attribute names inside foreign
/// content (MathML, SVG).
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Debug)]
pub struct Attribute {
/// The name of the attribute (e.g. the `class` in `
`)
pub name: QualName,
/// The value of the attribute (e.g. the `"test"` in `
`)
pub value: StrTendril,
}
#[cfg(test)]
mod tests {
use super::Namespace;
#[test]
fn ns_macro() {
assert_eq!(ns!(), Namespace::from(""));
assert_eq!(ns!(html), Namespace::from("http://www.w3.org/1999/xhtml"));
assert_eq!(
ns!(xml),
Namespace::from("http://www.w3.org/XML/1998/namespace")
);
assert_eq!(ns!(xmlns), Namespace::from("http://www.w3.org/2000/xmlns/"));
assert_eq!(ns!(xlink), Namespace::from("http://www.w3.org/1999/xlink"));
assert_eq!(ns!(svg), Namespace::from("http://www.w3.org/2000/svg"));
assert_eq!(
ns!(mathml),
Namespace::from("http://www.w3.org/1998/Math/MathML")
);
}
}