diff options
author | Martin Fischer <martin@push-f.com> | 2021-04-08 10:01:14 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2021-04-08 15:40:48 +0200 |
commit | fc9d3132f390b038544e45048b4fe345a3d47793 (patch) | |
tree | 0178d2f7abc72590147f4fb9585abfd37b978d54 /src/tokenizer/interface.rs | |
parent | da4bd49ed1d51461e0841d426784cab4c0f84d1d (diff) |
merge Attribute from markup5ever
Diffstat (limited to 'src/tokenizer/interface.rs')
-rw-r--r-- | src/tokenizer/interface.rs | 17 |
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 { |