aboutsummaryrefslogtreecommitdiff
path: root/src/machine.rs
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2023-08-15 11:26:08 +0200
committerMartin Fischer <martin@push-f.com>2023-08-19 13:41:55 +0200
commit82898967320f90116bbc686ab7ffc2f61ff456c4 (patch)
tree36c37d200945e20b331d271576e3255cfcc48d16 /src/machine.rs
parenta83e64e81de66ff40cc8a6293f0b5650d431689c (diff)
fix!: add adjusted_current_node_present_and_not_in_html_namespace to Emitter
Diffstat (limited to 'src/machine.rs')
-rw-r--r--src/machine.rs21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/machine.rs b/src/machine.rs
index 0d99ab8..007f22f 100644
--- a/src/machine.rs
+++ b/src/machine.rs
@@ -939,17 +939,18 @@ where
Ok(ControlToken::Continue)
}
Some('[') if slf.try_read_string("CDATA[", true)? => {
- // missing: check for adjusted current element: we don't have an element stack
- // at all
- //
- // missing: cdata transition
- //
- // let's hope that bogus comment can just sort of skip over cdata
- slf.emit_error(Error::CdataInHtmlContent);
+ if slf
+ .emitter
+ .adjusted_current_node_present_and_not_in_html_namespace()
+ {
+ slf.state = State::CdataSection;
+ } else {
+ slf.emit_error(Error::CdataInHtmlContent);
- slf.emitter.init_comment(slf.reader.position());
- slf.emitter.push_comment("[CDATA[");
- slf.state = State::BogusComment;
+ slf.emitter.init_comment(slf.reader.position());
+ slf.emitter.push_comment("[CDATA[");
+ slf.state = State::BogusComment;
+ }
Ok(ControlToken::Continue)
}
c => {