From 30b4adf60b9423968b0c9c6d23363f6d8cd99384 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Fri, 22 Sep 2023 15:34:46 +0200 Subject: break!: remove CdataAction Which action the tokenizer takes depending on whether or not an adjusted current node is present but not in the HTML namespace, is an implementation detail and shouldn't be exposed in the API. --- src/tokenizer/machine.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/tokenizer') 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(slf: &mut Machine, action: CdataAction) -where +pub(super) fn handle_cdata_open( + slf: &mut Machine, + adjusted_current_node_present_and_not_in_html_namespace: bool, +) where O: Offset, R: Reader + Position, E: Emitter, { - 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; } } -- cgit v1.2.3