aboutsummaryrefslogtreecommitdiff
path: root/src/tokenizer
diff options
context:
space:
mode:
Diffstat (limited to 'src/tokenizer')
-rw-r--r--src/tokenizer/machine.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/tokenizer/machine.rs b/src/tokenizer/machine.rs
index d5a1f87..faf1ea8 100644
--- a/src/tokenizer/machine.rs
+++ b/src/tokenizer/machine.rs
@@ -2,7 +2,6 @@ mod utils;
use crate::entities::try_read_character_reference;
use crate::offset::{Offset, Position};
-use crate::tokenizer::CdataAction;
use crate::trace::AttrValueSyntax;
use crate::{reader::Reader, Emitter, Error};
use utils::{
@@ -2041,21 +2040,22 @@ where
}
#[inline]
-pub(super) fn handle_cdata_open<O, R, E>(slf: &mut Machine<R, O, E>, action: CdataAction)
-where
+pub(super) fn handle_cdata_open<O, R, E>(
+ slf: &mut Machine<R, O, E>,
+ adjusted_current_node_present_and_not_in_html_namespace: bool,
+) where
O: Offset,
R: Reader + Position<O>,
E: Emitter<O>,
{
- match action {
- CdataAction::Cdata => slf.state = State::CdataSection,
- CdataAction::BogusComment => {
- slf.emit_error(Error::CdataInHtmlContent);
+ if 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;
}
}