Skip to content

refactor(css): remove dead rules and obsolete vendor prefixes#12845

Closed
lokesh wants to merge 2 commits into
internetarchive:masterfrom
lokesh:legacy-css
Closed

refactor(css): remove dead rules and obsolete vendor prefixes#12845
lokesh wants to merge 2 commits into
internetarchive:masterfrom
lokesh:legacy-css

Conversation

@lokesh

@lokesh lokesh commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Closes #

Housekeeping refactor of our CSS: remove dead rules from legacy.css and strip obsolete vendor prefixes across the stylesheets. No intended visual change — this is pure cleanup.

Technical

legacy.css dead-code removal. Every selector defined directly in legacy.css was checked against templates/, macros/, plugins/ (JS), components/ (Vue), scripts/, and data/. Removed only selectors with zero references in markup or JS, e.g. table.help, li span.snippet, span.tools.sorter, span.resultType, p.info/p.thanks, .serp-extras, div#content/contentLists, div.valid, .siteSearch.darker, div.verify, .forgot-email, .waitlist-msg, div.list, div.work, fieldset.minor, ul.clean, unused span.actions sprite states, div.preSubmit/.postSubmit, .heart-adjust, div#subjectLists, .contentThreeQuarter.

Why the removals are safe:

  • Each removed selector returns no hits in markup/JS, so the rules were inert.
  • Several borderline tokens were re-verified and kept because they are used: popAlert, table.meta td.descrip (WorkInfo), search-row, #listTools span.export/subscribe/alert, #placement/#position (generated by data/sitemap.py), div.alert, SRPCoverBlank, and the span.actions span.read/.borrow/.daisy states.
  • One latent bug was found: li.edition-cover img:hover never matched because the markup is a div, not an li — so removing it changes nothing on screen.

No-op / redundant declarations removed: an empty background-image: url(), an IE-only filter: alpha(opacity=20), and a duplicate #contentHead h1 rule.

Consolidations (behavior-preserving): grouped the identical merge-status rules (#preMerge/#postMerge/#errorMerge, varying only the icon) and the content-fraction helpers (.contentQuarter/.contentTwothird/.contentOnethird/.contentHalf).

Vendor-prefix sweep. Removed obsolete -webkit-box-*, -ms-flex*, -moz-*, and -o-* flexbox/transition/transform/box-shadow prefixes across legacy.css and several component files. These predate our browserslist (Safari ≥ 11.1, iOS ≥ 11.3, no IE) and the standard property was already present beside each. Where no unprefixed fallback existed, the declaration was converted rather than deleted (chart Y-axis rotate, rating-form transition, scrollbar box-shadow). Prefixes still required for our targets were kept (-webkit-line-clamp + its -webkit-box/-webkit-box-orient idiom, ::-webkit-scrollbar, -webkit-mask, -webkit-appearance, ::-webkit-details-marker, -webkit-tap-highlight-color, etc.). The vendored static/css/lib/ was left untouched.

pre-commit (stylelint) passes; npx prettier --check passes.

Testing

  1. Rebuild CSS and hard-refresh (disable cache).
  2. Header bar on any page — resize through mobile (<768px), tablet (768–959px), desktop (≥960px); confirm logo/nav/search/account/hamburger order and the search bar flexing are unchanged (widest blast radius — touches the inlined header @media flex rules).
  3. /search?q=harry+potter — toggle list vs grid view; check result titles, author/publisher lines, availability buttons (where most removed selectors nominally lived).
  4. Author merge UI — confirm the merge/check/alert status icons still render beside their text (consolidated background shorthand).
  5. /subjects/love and /publishers/Penguin — confirm the "Lists" section still lays out correctly.
  6. /help/markdown — confirm the syntax table is still styled.
  7. Spot-check: a book edit page (fieldset widths), a list embed page (action icons), an account alert page.

Quickest approach: open each page side-by-side against a master build and diff visually.

Screenshot

Stakeholders

lokesh added 2 commits June 2, 2026 22:41
Audit of legacy.css plus a sweep of obsolete vendor prefixes across
component CSS.

legacy.css:
- Remove selector blocks verified unused across templates, macros, and
  JS (e.g. table.help, div.list, div.work, #subjectLists, fieldset.minor,
  .serp-extras, .waitlist-msg, span.resultType, unused span.actions
  sprite states, etc.)
- Drop no-op declarations: empty background-image: url(), IE-only
  filter: alpha(), and the duplicate #contentHead h1 rule.
- Consolidate identical rules: merge-status icons (#preMerge/#postMerge/
  #errorMerge) and content-fraction helpers (.contentQuarter et al.).

Vendor prefixes:
- Remove obsolete -webkit-box-*, -ms-flex*, -moz-, and -o- flexbox/
  transition/transform/box-shadow prefixes that predate our browserslist
  (Safari >= 11.1, iOS >= 11.3, no IE); standard properties already
  present. Where no unprefixed fallback existed (chart rotate, rating-form
  transition, scrollbar box-shadow) the declaration was converted.
- Keep -webkit- prefixes still required (line-clamp, scrollbar, mask,
  appearance, details-marker, tap-highlight, etc.). Vendored lib/ untouched.
# Conflicts:
#	static/css/components/header-bar.css
#	static/css/legacy.css
@lokesh lokesh closed this Jun 23, 2026
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