aboutsummaryrefslogtreecommitdiff
path: root/src/tokenizer/interface.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tokenizer/interface.rs')
-rw-r--r--src/tokenizer/interface.rs17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/tokenizer/interface.rs b/src/tokenizer/interface.rs
index 35ba9c5..ebb8569 100644
--- a/src/tokenizer/interface.rs
+++ b/src/tokenizer/interface.rs
@@ -7,10 +7,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use markup5ever::interface::Attribute;
use tendril::StrTendril;
use crate::tokenizer::states;
-use markup5ever::LocalName;
+use markup5ever::{LocalName, QualName};
use std::borrow::Cow;
pub use self::TagKind::{EndTag, StartTag};
@@ -44,6 +43,20 @@ pub enum TagKind {
EndTag,
}
+/// A tag attribute, e.g. `class="test"` in `<div class="test" ...>`.
+///
+/// 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 `<div class="test">`)
+ pub name: QualName,
+ /// The value of the attribute (e.g. the `"test"` in `<div class="test">`)
+ pub value: StrTendril,
+}
+
/// A tag token.
#[derive(PartialEq, Eq, Clone, Debug)]
pub struct Tag {