diff options
author | Martin Fischer <martin@push-f.com> | 2023-09-01 13:22:51 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2023-09-03 23:00:05 +0200 |
commit | 55e6341d11aa4a51bb0a45e3719eb44c3706b0da (patch) | |
tree | 93946bbda6910aef722182ced49a045ba0550e13 /src/machine.rs | |
parent | 6556106154d7e7cbc7820f223b9baaf49a900449 (diff) |
fix: make doctype id spans encoding-independent
Diffstat (limited to 'src/machine.rs')
-rw-r--r-- | src/machine.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/machine.rs b/src/machine.rs index 5c5c533..f00af0a 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -1359,6 +1359,8 @@ where }, State::DoctypePublicIdentifierDoubleQuoted => match slf.read_char()? { Some('"') => { + slf.emitter + .terminate_doctype_public_id(slf.position_before_match); slf.state = State::AfterDoctypePublicIdentifier; Ok(ControlToken::Continue) } @@ -1368,6 +1370,8 @@ where Ok(ControlToken::Continue) } Some('>') => { + slf.emitter + .terminate_doctype_public_id(slf.position_before_match); slf.emit_error(Error::AbruptDoctypePublicIdentifier); slf.emitter.set_force_quirks(); slf.state = State::Data; @@ -1375,6 +1379,8 @@ where Ok(ControlToken::Continue) } None => { + slf.emitter + .terminate_doctype_public_id(slf.reader.position()); slf.emit_error(Error::EofInDoctype); slf.emitter.set_force_quirks(); slf.emitter.emit_current_doctype(slf.reader.position()); @@ -1387,6 +1393,8 @@ where }, State::DoctypePublicIdentifierSingleQuoted => match slf.read_char()? { Some('\'') => { + slf.emitter + .terminate_doctype_public_id(slf.position_before_match); slf.state = State::AfterDoctypePublicIdentifier; Ok(ControlToken::Continue) } @@ -1396,6 +1404,8 @@ where Ok(ControlToken::Continue) } Some('>') => { + slf.emitter + .terminate_doctype_public_id(slf.position_before_match); slf.emit_error(Error::AbruptDoctypePublicIdentifier); slf.emitter.set_force_quirks(); slf.state = State::Data; @@ -1403,6 +1413,8 @@ where Ok(ControlToken::Continue) } None => { + slf.emitter + .terminate_doctype_public_id(slf.reader.position()); slf.emit_error(Error::EofInDoctype); slf.emitter.set_force_quirks(); slf.emitter.emit_current_doctype(slf.reader.position()); @@ -1553,6 +1565,8 @@ where }, State::DoctypeSystemIdentifierDoubleQuoted => match slf.read_char()? { Some('"') => { + slf.emitter + .terminate_doctype_system_id(slf.position_before_match); slf.state = State::AfterDoctypeSystemIdentifier; Ok(ControlToken::Continue) } @@ -1562,6 +1576,8 @@ where Ok(ControlToken::Continue) } Some('>') => { + slf.emitter + .terminate_doctype_system_id(slf.position_before_match); slf.emit_error(Error::AbruptDoctypeSystemIdentifier); slf.emitter.set_force_quirks(); slf.state = State::Data; @@ -1569,6 +1585,8 @@ where Ok(ControlToken::Continue) } None => { + slf.emitter + .terminate_doctype_system_id(slf.reader.position()); slf.emit_error(Error::EofInDoctype); slf.emitter.set_force_quirks(); slf.emitter.emit_current_doctype(slf.reader.position()); @@ -1581,6 +1599,8 @@ where }, State::DoctypeSystemIdentifierSingleQuoted => match slf.read_char()? { Some('\'') => { + slf.emitter + .terminate_doctype_system_id(slf.position_before_match); slf.state = State::AfterDoctypeSystemIdentifier; Ok(ControlToken::Continue) } @@ -1590,6 +1610,8 @@ where Ok(ControlToken::Continue) } Some('>') => { + slf.emitter + .terminate_doctype_system_id(slf.position_before_match); slf.emit_error(Error::AbruptDoctypeSystemIdentifier); slf.emitter.set_force_quirks(); slf.state = State::Data; @@ -1597,6 +1619,8 @@ where Ok(ControlToken::Continue) } None => { + slf.emitter + .terminate_doctype_system_id(slf.reader.position()); slf.emit_error(Error::EofInDoctype); slf.emitter.set_force_quirks(); slf.emitter.emit_current_doctype(slf.reader.position()); |