Skip to content

--computed: list prefixed declarations only one side's CSS source has - #155

Merged
tmashara merged 2 commits into
mainfrom
claude/issue-150-prefixes
Nov 4, 2026
Merged

tmashara merged 2 commits into
mainfrom
claude/issue-150-prefixes

Conversation

@tmashara

@tmashara tmashara commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Refs #150

A Stylelint autofix that turns -webkit-text-size-adjust, -webkit-background-clip: text and -webkit-user-select into their unprefixed forms passes a Chromium run on pixels and on --computed. Chromium honours both spellings, and its CSSOM serialises the prefixed name as the unprefixed one, so even rule coverage sees identical rules. Shooting in WebKit doesn't help either: measured on Playwright WebKit 26.5, none of the three changes a pixel, and desktop WebKit drops both spellings of text-size-adjust when it parses them.

So --computed now also reads each side's CSS as written and compares the vendor-prefixed declarations.

  • Source: every main-frame stylesheet response body, read in page.on("response") while it is still available, which covers cross-origin sheets the CSSOM can't read. Also the text of every <style>, open shadow roots included.
  • Comparison: a multiset of -(webkit|moz|ms|o)-prop: value declarations, with comments and whitespace normalised, ignoring which selector or file holds them. Minifying, reordering, moving a declaration between files or a new asset hash is no finding; one side holding an extra copy is.
  • Output: a prefixes: block after rules:, informational like it, never changing the exit code. Up to 10 declarations shown per side with (+N more).
  • results.json: computed.prefixes: { left, right } per shot and summary.prefixes ({ side, declaration, at }).
prefixes: 3 prefixed declarations only one side has
  only left has: -webkit-background-clip: text; -webkit-text-size-adjust: 100%; -webkit-user-select: none  /prefix@1440,375

Not seen: insertRule, adopted sheets, style attributes, and prefixed selectors, media features or values. The docs say so.

Tests

  • Unit: extraction, covering normalisation, what it leaves out (selectors, media features, values) and the multiset diff; and the console block, covering the cap and the empty line.
  • prefix fixture: one prefixed declaration in an inline <style>, one in a same-origin <link>, one in a cross-origin <link> (localhost vs 127.0.0.1, unreadable to the CSSOM). Chromium keeps pixel parity and lists all three.
  • prefix-same fixture: the same set minified, reordered, moved between <style> and sheet, under a hashed file name. No finding.
  • The equivalence and control corpus under --computed: no prefix findings. Run by hand over the whole corpus (60 routes × 2 widths): none either.
  • typecheck, lint, format:check, npm test, and the guardrails, computed, controls, equivalence and accepted visual files pass locally.

🤖 Generated with Claude Code

tmashara and others added 2 commits November 4, 2026 14:15
Chromium's CSSOM serialises -webkit-user-select as user-select, so a lint
autofix that drops a prefix Safari needs passes pixels and rule coverage
alike. Read each load's stylesheet bodies as served and every <style>'s
text, and print a prefixes: line next to rules: with the -webkit-/-moz-/
-ms-/-o- declarations one side has more of. Informational, like rules:.

Refs #150

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… stripping

A minifier rewrites values (0.3s to .3s), so a build upgrade read as
left/right pairs that buried a dropped prefix; count each prefixed
property's declarations per side and show a value only as context.
A /* inside url() or a string no longer swallows the CSS after it, and a
data URI's ; stays in its value. Sheets reset on every new main-frame
document, not only at the job's load, and the prefix read runs beside
rule coverage, each in its own timeout. The fixture gains an @import.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tmashara
tmashara merged commit 3208f65 into main Nov 4, 2026
3 checks passed
@tmashara
tmashara deleted the claude/issue-150-prefixes branch November 4, 2026 13:44
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