Hide head, script, and style tags from render tree

This commit is contained in:
SGavrl
2026-07-02 22:21:19 +00:00
parent 740caaea06
commit cd1ee2dcc5
2 changed files with 5 additions and 0 deletions

View File

@@ -267,6 +267,9 @@ fn build(
let _name = node.as_element()?;
let style = styles.get(&id)?;
if style.display == crate::Display::None {
return None;
}
let mut taffy_style = to_taffy_style(style);
// Emulate HTML table layout by giving the last td in a tr all remaining space

View File

@@ -37,6 +37,8 @@ pub fn ua_style(tag: &str) -> LayoutStyle {
style.display = Display::Flex;
style.flex_direction = Some(taffy::FlexDirection::Column);
style.align_items = Some(taffy::AlignItems::Center);
} else if tag == "head" || tag == "script" || tag == "style" || tag == "title" || tag == "meta" || tag == "link" {
style.display = Display::None;
} else if tag == "body" {
style.margin = Edges { top: 8.0, right: 8.0, bottom: 8.0, left: 8.0 };
} else if tag == "table" || tag == "tbody" {