Skip to content

Match a display:none style case-insensitively, as CSS does - #124

Merged
only-cli merged 1 commit into
mainfrom
fix/style-value-case-insensitive
Oct 5, 2026
Merged

only-cli merged 1 commit into
mainfrom
fix/style-value-case-insensitive

Conversation

@only-cli

@only-cli only-cli commented Oct 5, 2026

Copy link
Copy Markdown
Owner

Follow-up to #123, which noted that an uppercase style value still got through.

CSS property names and keywords are case-insensitive, and a space before the colon is valid. The hidden check only matched lowercase display:none, so content styled DISPLAY:NONE, Display: None or display : none leaked into the view and into raw.

Both checks (the hidden test in distill() and the sweep in cleanDocument()) now share one pattern, /display\s*:\s*none/i.

Verification:

  • New test in tests/distill.test.js covering all three spellings in the view, toMarkdown and toHTML. It fails without the change (secret-upper leaked) and passes with it.
  • npm test: 322/322 pass.

🤖 Generated with Claude Code

CSS property names and keywords are case-insensitive and may have space
before the colon, but the hidden check only matched lowercase
"display:none". Content styled DISPLAY:NONE, Display: None or
display : none leaked into the view and into raw. Both paths now share
one case-insensitive pattern.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@only-cli
only-cli merged commit 64c5efd into main Oct 5, 2026
5 checks passed
@only-cli
only-cli deleted the fix/style-value-case-insensitive branch October 5, 2026 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant