aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tokenizer/mod.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/tokenizer/mod.rs b/src/tokenizer/mod.rs
index fa01be8..f5968b2 100644
--- a/src/tokenizer/mod.rs
+++ b/src/tokenizer/mod.rs
@@ -418,6 +418,17 @@ impl<Sink: TokenSink> Tokenizer<Sink> {
}
}
+ // https://html.spec.whatwg.org/multipage/#concept-frag-parse-context
+ let next_state = match name.as_str() {
+ "title" | "textarea" => states::RawData(RawKind::Rcdata),
+ "style" | "xmp" | "iframe" | "noembed" | "noframes" => {
+ states::RawData(RawKind::Rawtext)
+ }
+ "script" => states::RawData(RawKind::ScriptData),
+ "plaintext" => states::Plaintext,
+ _other => states::Data,
+ };
+
let token = TagToken(Tag {
kind: self.current_tag_kind,
name,
@@ -426,7 +437,10 @@ impl<Sink: TokenSink> Tokenizer<Sink> {
});
match self.process_token(token) {
- TokenSinkResult::Continue => ControlFlow::Continue(()),
+ TokenSinkResult::Continue => {
+ self.state = next_state;
+ ControlFlow::Continue(())
+ }
TokenSinkResult::Plaintext => {
self.state = states::Plaintext;
ControlFlow::Continue(())