summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-12-03 07:21:18 +0100
committerMartin Fischer <martin@push-f.com>2021-12-05 02:45:31 +0100
commit91c0008023746a9ffdd01b9b87f89a2ef4ebb01e (patch)
tree719dd3cd8a9fd76b03c20dfa10b7ee0894b998f4
parent7e400c29bf14bd75154c74e2dd9ba0814f83bec7 (diff)
fix wrong state transition in ScriptDataLessThanSign state
Before the following happened: % printf '<script><b>test</b></script>' | cargo run --example=switch-state StartTag(StartTag { self_closing: false, name: "script", attributes: {} }) String("<b>test") EndTag(EndTag { name: "b" }) EndTag(EndTag { name: "script" }) Which is obviously wrong. After a <script> tag we want to switch to the ScriptData state (instead of the Data state). This commit fixes this implementation error, making the above command produce the expected output of: StartTag(StartTag { self_closing: false, name: "script", attributes: {} }) String("<b>test</b>") EndTag(EndTag { name: "script" })
-rw-r--r--src/machine.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/machine.rs b/src/machine.rs
index 9f728dd..5222735 100644
--- a/src/machine.rs
+++ b/src/machine.rs
@@ -326,7 +326,7 @@ pub fn consume<R: Reader, E: Emitter>(slf: &mut Tokenizer<R, E>) -> Result<Contr
}
c => {
slf.emitter.emit_string("<");
- slf.state = State::Data;
+ slf.state = State::ScriptData;
slf.unread_char(c);
Ok(ControlToken::Continue)
}