diff --git a/src/browser/StyleManager.zig b/src/browser/StyleManager.zig index 93a9a5f25..79936e1d3 100644 --- a/src/browser/StyleManager.zig +++ b/src/browser/StyleManager.zig @@ -326,6 +326,15 @@ pub fn hasDisplayNone(self: *StyleManager, el: *Element) bool { return self.isElementHidden(el, .{}); } +/// Computed display:none coming only from inline style or an author stylesheet +/// rule — the UA stylesheet's hidden elements (,

Title

visible & well

+ ); +} + +test "dump: with_base injects a element" { + try expectDump(.{ .with_base = true }, + \\ + \\

Title

visible & well

+ ); +} + +test "dump: strip.js removes script and noscript" { + try expectDump(.{ .strip = .{ .js = true } }, + \\ + \\

Title

visible & well

+ ); +} + +test "dump: strip.css removes style and stylesheet links" { + try expectDump(.{ .strip = .{ .css = true } }, + \\ + \\

Title

visible & well

+ ); +} + +test "dump: strip.ui removes css plus visual elements" { + try expectDump(.{ .strip = .{ .ui = true } }, + \\ + \\

Title

visible & well

+ ); +} + +test "dump: strip.invisible removes author display:none elements" { + try expectDump(.{ .strip = .{ .invisible = true } }, + \\ + \\

Title

visible & well

+ ); +} diff --git a/src/browser/tests/dump.html b/src/browser/tests/dump.html new file mode 100644 index 000000000..462a2e1f1 --- /dev/null +++ b/src/browser/tests/dump.html @@ -0,0 +1 @@ +

Title

visible & well

\ No newline at end of file diff --git a/src/help.zon b/src/help.zon index 0072a7cad..ed3f04dd0 100644 --- a/src/help.zon +++ b/src/help.zon @@ -63,10 +63,11 @@ \\ Comma-separated list of tag groups to remove from dump. \\ Defaults to no-strip. \\ Allowed values: - \\ js script and link[as=script, rel=preload]. - \\ ui Includes img, picture, video, CSS and SVG. - \\ css Includes style and link[rel=stylesheet]. - \\ full Strip everything. + \\ js Script and link[as=script, rel=preload]. + \\ ui Includes img, picture, video, CSS and SVG. + \\ css Includes style and link[rel=stylesheet]. + \\ invisible Best-effort (e.g. display:none) hidden elements + \\ full Strip everything. \\ --json \\ Capture and print the status of the fetch in a JSON string and output \\ it. When used with --dump this will wrap the dumped content