aboutsummaryrefslogtreecommitdiff
path: root/src/machine.rs
diff options
context:
space:
mode:
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 => {