aboutsummaryrefslogtreecommitdiff
path: root/src/tokenizer.rs
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.rs
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.rs')
-rw-r--r--src/tokenizer.rs26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/tokenizer.rs b/src/tokenizer.rs
index b41c208..cd5ae71 100644
--- a/src/tokenizer.rs
+++ b/src/tokenizer.rs
@@ -49,14 +49,20 @@ impl<R: Reader + Position<O>, O: Offset, E: Emitter<O>> Tokenizer<R, O, E> {
/// To be called when the tokenizer iterator implementation yields [`Event::CdataOpen`].
///
- /// For spec-compliant parsing *action* must be [`CdataAction::Cdata`],
+ /// For spec-compliant parsing the supplied boolean must be `true`
/// if there is an _adjusted current node_ and it is not an element in
- /// the HTML namespace, or [`CdataAction::BogusComment`] otherwise
- /// (as per the third condition under [Markup declaration open state]).
+ /// the HTML namespace, or `false` otherwise (as per the third condition
+ /// under [Markup declaration open state]).
///
/// [Markup declaration open state]: https://html.spec.whatwg.org/multipage/parsing.html#markup-declaration-open-state
- pub fn handle_cdata_open(&mut self, action: CdataAction) {
- machine::handle_cdata_open(&mut self.machine, action);
+ pub fn handle_cdata_open(
+ &mut self,
+ adjusted_current_node_present_and_not_in_html_namespace: bool,
+ ) {
+ machine::handle_cdata_open(
+ &mut self.machine,
+ adjusted_current_node_present_and_not_in_html_namespace,
+ );
}
/// Returns a mutable reference to the emitter.
@@ -65,16 +71,6 @@ impl<R: Reader + Position<O>, O: Offset, E: Emitter<O>> Tokenizer<R, O, E> {
}
}
-/// Used by [`Tokenizer::handle_cdata_open`] to determine how to process `<![CDATA[`
-///
-/// (Since as per the spec this depends on the _adjusted current node_).
-pub enum CdataAction {
- /// Process it as CDATA.
- Cdata,
- /// Process it as a bogus comment.
- BogusComment,
-}
-
/// An event yielded by the [`Iterator`] implementation for the [`Tokenizer`].
#[derive(Debug)]
pub enum Event<T> {