From d2f45c78f1844a04798a5ea3303d0f21467da967 Mon Sep 17 00:00:00 2001 From: Christopher Fraser Date: Tue, 17 Sep 2024 22:24:12 +1000 Subject: [PATCH] Unset list item data if previously set (#137) --- packages/dom/src/layout/construct.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/dom/src/layout/construct.rs b/packages/dom/src/layout/construct.rs index 190b873b..097c9103 100644 --- a/packages/dom/src/layout/construct.rs +++ b/packages/dom/src/layout/construct.rs @@ -229,6 +229,12 @@ fn collect_list_item_children( node.element_data_mut().unwrap().list_item_data = Some(Box::new(layout)); *index += 1; collect_list_item_children(doc, index, reversed, child); + } else { + // Unset marker in case it was previously set + let node = &mut doc.nodes[child]; + if let Some(element_data) = node.element_data_mut() { + element_data.list_item_data = None; + } } } } @@ -262,7 +268,6 @@ fn node_list_item_child(doc: &mut Document, child: usize, index: usize) -> Optio let styles = node.primary_styles().unwrap(); let list_style_type = styles.clone_list_style_type(); let list_style_position = styles.clone_list_style_position(); - let marker = marker_for_style(list_style_type, index)?; let position = match list_style_position {