aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/machine.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/machine.rs b/src/machine.rs
index 082ab68..5910667 100644
--- a/src/machine.rs
+++ b/src/machine.rs
@@ -1159,7 +1159,7 @@ where
}
None => {
slf.emit_error(Error::EofInDoctype);
- slf.emitter.init_doctype(slf.doctype_offset);
+ slf.init_doctype();
slf.emitter.set_force_quirks();
slf.emitter.emit_current_doctype(slf.reader.position());
Ok(ControlToken::Eof)
@@ -1175,14 +1175,14 @@ where
Some(whitespace_pat!()) => Ok(ControlToken::Continue),
Some('\0') => {
slf.emit_error(Error::UnexpectedNullCharacter);
- slf.emitter.init_doctype(slf.doctype_offset);
+ slf.init_doctype();
slf.emitter.push_doctype_name("\u{fffd}");
slf.state = State::DoctypeName;
Ok(ControlToken::Continue)
}
Some('>') => {
slf.emit_error(Error::MissingDoctypeName);
- slf.emitter.init_doctype(slf.doctype_offset);
+ slf.init_doctype();
slf.emitter.set_force_quirks();
slf.state = State::Data;
slf.emitter.emit_current_doctype(slf.reader.position());
@@ -1190,13 +1190,13 @@ where
}
None => {
slf.emit_error(Error::EofInDoctype);
- slf.emitter.init_doctype(slf.doctype_offset);
+ slf.init_doctype();
slf.emitter.set_force_quirks();
slf.emitter.emit_current_doctype(slf.reader.position());
Ok(ControlToken::Eof)
}
Some(x) => {
- slf.emitter.init_doctype(slf.doctype_offset);
+ slf.init_doctype();
slf.emitter
.push_doctype_name(ctostr!(x.to_ascii_lowercase()));
slf.state = State::DoctypeName;
@@ -1892,6 +1892,13 @@ where
}
}
+impl<R: Reader + Position<O>, O: Offset, E: Emitter<O>> Tokenizer<R, O, E> {
+ #[inline]
+ fn init_doctype(&mut self) {
+ self.emitter.init_doctype(self.doctype_offset);
+ }
+}
+
#[inline]
pub fn handle_cdata_open<O, R, E>(slf: &mut Tokenizer<R, O, E>, action: CdataAction)
where