diff options
Diffstat (limited to 'src/tokenizer/mod.rs')
-rw-r--r-- | src/tokenizer/mod.rs | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/tokenizer/mod.rs b/src/tokenizer/mod.rs index c6f7276..f45c917 100644 --- a/src/tokenizer/mod.rs +++ b/src/tokenizer/mod.rs @@ -25,7 +25,6 @@ use crate::util::{smallcharset::SmallCharSet, str::lower_ascii_letter}; use log::debug; use mac::{_tt_as_expr_hack, format_if, matches}; -use markup5ever::{namespace_url, ns}; use std::borrow::Cow::{self, Borrowed}; use std::collections::BTreeMap; use std::default::Default; @@ -33,7 +32,6 @@ use std::mem::replace; pub use crate::util::buffer_queue::{BufferQueue, FromSet, NotFromSet, SetResult}; use tendril::StrTendril; -use markup5ever::{LocalName, QualName}; mod char_ref; mod interface; @@ -155,7 +153,7 @@ pub struct Tokenizer<Sink> { current_doctype: Doctype, /// Last start tag name, for use in checking "appropriate end tag". - last_start_tag_name: Option<LocalName>, + last_start_tag_name: Option<StrTendril>, /// The "temporary buffer" mentioned in the spec. temp_buf: StrTendril, @@ -176,7 +174,7 @@ impl<Sink: TokenSink> Tokenizer<Sink> { let start_tag_name = opts .last_start_tag_name .take() - .map(|s| LocalName::from(&*s)); + .map(|s| StrTendril::from(s)); let state = opts.initial_state.unwrap_or(states::Data); let discard_bom = opts.discard_bom; Tokenizer { @@ -412,7 +410,7 @@ impl<Sink: TokenSink> Tokenizer<Sink> { fn emit_current_tag(&mut self) -> ProcessResult<Sink::Handle> { self.finish_attribute(); - let name = LocalName::from(&*self.current_tag_name); + let name = self.current_tag_name.clone(); self.current_tag_name.clear(); match self.current_tag_kind { @@ -506,7 +504,7 @@ impl<Sink: TokenSink> Tokenizer<Sink> { let name = &*self.current_attr_name; self.current_tag_attrs .iter() - .any(|a| &*a.name.local == name) + .any(|a| &*a.name == name) }; if dup { @@ -514,12 +512,10 @@ impl<Sink: TokenSink> Tokenizer<Sink> { self.current_attr_name.clear(); self.current_attr_value.clear(); } else { - let name = LocalName::from(&*self.current_attr_name); + let name = self.current_attr_name.clone(); self.current_attr_name.clear(); self.current_tag_attrs.push(Attribute { - // The tree builder will adjust the namespace if necessary. - // This only happens in foreign elements. - name: QualName::new(None, ns!(), name), + name: name, value: replace(&mut self.current_attr_value, StrTendril::new()), }); } @@ -1538,8 +1534,6 @@ mod test { use crate::util::buffer_queue::BufferQueue; use std::mem::replace; - use markup5ever::LocalName; - // LinesMatch implements the TokenSink trait. It is used for testing to see // if current_line is being updated when process_token is called. The lines // vector is a collection of the line numbers that each token is on. @@ -1630,7 +1624,7 @@ mod test { // Create a tag token fn create_tag(token: StrTendril, tagkind: TagKind) -> Token { - let name = LocalName::from(&*token); + let name = token; let token = TagToken(Tag { kind: tagkind, name, |