aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/machine.rs2
-rw-r--r--src/tokenizer.rs8
2 files changed, 4 insertions, 6 deletions
diff --git a/src/machine.rs b/src/machine.rs
index 84fb525..b23e5f2 100644
--- a/src/machine.rs
+++ b/src/machine.rs
@@ -46,6 +46,7 @@ where
Ok(ControlToken::Continue)
}
Some('<') => {
+ slf.some_offset = slf.reader.position() - 1;
slf.state = State::TagOpen;
Ok(ControlToken::Continue)
}
@@ -947,7 +948,6 @@ where
}
Some('d' | 'D') if slf.try_read_string("octype", false)? => {
slf.state = State::Doctype;
- slf.some_offset = slf.reader.position() - b"<!doctype".len();
Ok(ControlToken::Continue)
}
Some('[') if slf.try_read_string("CDATA[", true)? => Ok(ControlToken::CdataOpen),
diff --git a/src/tokenizer.rs b/src/tokenizer.rs
index 89d743a..83c3965 100644
--- a/src/tokenizer.rs
+++ b/src/tokenizer.rs
@@ -49,7 +49,7 @@ pub struct Tokenizer<R: Reader, O, E: Emitter<O>> {
current_tag_name: String,
last_start_tag_name: String,
is_start_tag: bool,
- /// * Set to the start offset of `<!doctype` in [`InternalState::MarkupDeclarationOpen`].
+ /// * Set to the offset of `<` in [`InternalState::Data`].
/// * Set to the offset of `&` in [`InternalState::CharacterReference`].
pub(crate) some_offset: O,
/// This boolean flag exists so that the [`NaiveParser`](crate::NaiveParser) can work with any [`Emitter`]
@@ -218,16 +218,14 @@ impl<R: Reader + Position<O>, O: Offset, E: Emitter<O>> Tokenizer<R, O, E> {
#[inline]
pub(crate) fn init_start_tag(&mut self) {
- self.emitter
- .init_start_tag(self.reader.position() - "<".len() - 1);
+ self.emitter.init_start_tag(self.some_offset);
self.current_tag_name.clear();
self.is_start_tag = true;
}
#[inline]
pub(crate) fn init_end_tag(&mut self) {
- self.emitter
- .init_end_tag(self.reader.position() - "</".len() - 1);
+ self.emitter.init_end_tag(self.some_offset);
self.current_tag_name.clear();
self.is_start_tag = false;
}