aboutsummaryrefslogtreecommitdiff
path: root/src/tokenizer
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2023-09-22 15:34:46 +0200
committerMartin Fischer <martin@push-f.com>2023-09-28 10:36:08 +0200
commit30b4adf60b9423968b0c9c6d23363f6d8cd99384 (patch)
treeaafbdf781282b3440d3b217e6a2614e9cd65a03d /src/tokenizer
parentd46de6ab592e57a31fef13cfc015c4ce818e8f47 (diff)
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.
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;
}
}