Skip to content

Commit adccd21

Browse files
committed
Simplify check in Doctype and start search of a name after first space
1 parent d71f3f5 commit adccd21

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/reader/state.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,12 @@ impl ReaderState {
381381
);
382382
debug_assert!(content.ends_with(b">"), "{:?}", Bytes(content));
383383

384+
// Skip `<!DOCTYPE` and `>`
384385
let buf = &content[9..content.len() - 1];
385386
match buf.iter().position(|&b| !is_whitespace(b)) {
387+
// Found the first non-space symbol after `<!DOCTYPE`
388+
// Actually, parser will guarantee, that after `<!DOCTYPE`
389+
// at least one is_whitespace() symbol
386390
Some(start) => Ok(Event::DocType(BytesText::wrap(
387391
&buf[start..],
388392
self.decoder(),

0 commit comments

Comments
 (0)