The headless browser for AI agents and web scraping
Hide head, script, and style tags from render tree
SGavrlcd1ee2dcc5e9
diff --git a/crates/obscura-render/src/dom.rs b/crates/obscura-render/src/dom.rsindex ac68ca01..ca741df8 100644--- a/crates/obscura-render/src/dom.rs+++ b/crates/obscura-render/src/dom.rs@@ -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 spacediff --git a/crates/obscura-render/src/style.rs b/crates/obscura-render/src/style.rsindex 9247ea1d..49c661a2 100644--- a/crates/obscura-render/src/style.rs+++ b/crates/obscura-render/src/style.rs@@ -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" {