diff options
author | Martin Fischer <martin@push-f.com> | 2023-09-01 12:38:40 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2023-09-03 23:00:05 +0200 |
commit | 03ca8c1f599828eb12e60e6012684bb4c09dbf89 (patch) | |
tree | 27709eb8f048625ea45cfa76ea1671314bc4aba6 /src/emitter.rs | |
parent | 822cc78d438e8df6a068d811d3cc825b883aba36 (diff) |
fix!: calculate tag offsets in Tokenizer instead of Emitter impl
Diffstat (limited to 'src/emitter.rs')
-rw-r--r-- | src/emitter.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/emitter.rs b/src/emitter.rs index 9334121..ff6e863 100644 --- a/src/emitter.rs +++ b/src/emitter.rs @@ -275,7 +275,7 @@ impl<O: Offset> Emitter<O> for DefaultEmitter<O> { fn init_start_tag(&mut self, offset: O) { self.current_token = Some(Token::StartTag(StartTag { - span: offset - b"<".len()..offset - b"<".len(), + span: offset..O::default(), self_closing: false, name: String::new(), attributes: Default::default(), @@ -283,7 +283,7 @@ impl<O: Offset> Emitter<O> for DefaultEmitter<O> { } fn init_end_tag(&mut self, offset: O) { self.current_token = Some(Token::EndTag(EndTag { - span: offset - b"</".len()..offset - b"</".len(), + span: offset..O::default(), name: String::new(), })); self.seen_attributes.clear(); @@ -305,10 +305,10 @@ impl<O: Offset> Emitter<O> for DefaultEmitter<O> { self.push_error(Error::EndTagWithAttributes, span); } self.seen_attributes.clear(); - tag.span.end = offset + b">".len(); + tag.span.end = offset; } Token::StartTag(tag) => { - tag.span.end = offset + b">".len(); + tag.span.end = offset; } _ => debug_assert!(false), } |