refactor(css): remove dead rules and obsolete vendor prefixes#12845
Closed
lokesh wants to merge 2 commits into
Closed
refactor(css): remove dead rules and obsolete vendor prefixes#12845lokesh wants to merge 2 commits into
lokesh wants to merge 2 commits into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #
Housekeeping
refactorof our CSS: remove dead rules fromlegacy.cssand strip obsolete vendor prefixes across the stylesheets. No intended visual change — this is pure cleanup.Technical
legacy.cssdead-code removal. Every selector defined directly inlegacy.csswas checked againsttemplates/,macros/,plugins/(JS),components/(Vue),scripts/, anddata/. 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, unusedspan.actionssprite states,div.preSubmit/.postSubmit,.heart-adjust,div#subjectLists,.contentThreeQuarter.Why the removals are safe:
popAlert,table.meta td.descrip(WorkInfo),search-row,#listTools span.export/subscribe/alert,#placement/#position(generated bydata/sitemap.py),div.alert,SRPCoverBlank, and thespan.actions span.read/.borrow/.daisystates.li.edition-cover img:hovernever matched because the markup is adiv, not anli— so removing it changes nothing on screen.No-op / redundant declarations removed: an empty
background-image: url(), an IE-onlyfilter: alpha(opacity=20), and a duplicate#contentHead h1rule.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 acrosslegacy.cssand several component files. These predate ourbrowserslist(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-axisrotate,rating-formtransition, scrollbarbox-shadow). Prefixes still required for our targets were kept (-webkit-line-clamp+ its-webkit-box/-webkit-box-orientidiom,::-webkit-scrollbar,-webkit-mask,-webkit-appearance,::-webkit-details-marker,-webkit-tap-highlight-color, etc.). The vendoredstatic/css/lib/was left untouched.pre-commit(stylelint) passes;npx prettier --checkpasses.Testing
@mediaflex rules)./search?q=harry+potter— toggle list vs grid view; check result titles, author/publisher lines, availability buttons (where most removed selectors nominally lived).backgroundshorthand)./subjects/loveand/publishers/Penguin— confirm the "Lists" section still lays out correctly./help/markdown— confirm the syntax table is still styled.Quickest approach: open each page side-by-side against a
masterbuild and diff visually.Screenshot
Stakeholders