Remove legacy browser support JS - #1139
Open
stephaniehobson wants to merge 1 commit into
Open
stephaniehobson wants to merge 1 commit into
stephaniehobson wants to merge 1 commit into
Conversation
stephaniehobson
added this pull request to stack #1146
September 11, 2026 17:21
…1084) - Removed the Element.matches() IE8 polyfill from utils.js entirely. Native Element.prototype.matches is supported in every browser in the new matrix; nextUntil() already calls el.matches() directly so nothing downstream changes. - Collapsed the addEventListener-else-addListener MediaQueryList fallback in navigation.js, menu.js, and footer.js down to a plain addEventListener call. The standard MediaQueryList.addEventListener has been supported since Safari 14 / Firefox 55 / Chrome 55 -- fully covered by the new matrix -- so the legacy addListener branch never runs in any supported browser. - Bug fix: MzpSupports.matchMedia required window.matchMedia('all').addListener -- the *deprecated* legacy MediaQueryList API -- to consider matchMedia supported. Any browser that removes the deprecated addListener while keeping standard matchMedia (as browsers increasingly do) would make this detect return false, silently disabling sticky navigation and everything else gated on window.MzpSupports.matchMedia (menu.js, footer.js). Fixed to check only for matchMedia itself. - Simplified two IE9 classList-polyfill workarounds in menu.js (removing classes one-at-a-time "in the correct order" per mozilla/bedrock#6221) to a single classList.remove('a', 'b') call -- multi-argument remove() is reliable in every supported browser now that the IE9 bug it worked around is out of scope. Left MzpSupports' public API (matchMedia, requestAnimationFrame, cssFeatureQueries, classList, details, intersectionObserver) and its consumers' gate checks in place per the v23 plan -- it's a documented UMD entry point (webpack.entrypoints.js) referenced in components/details-component/readme.md, so removing it outright is a separate, bigger breaking-API decision than this cleanup. All six detects are now unconditionally true for the supported matrix, which is effectively dead code, but keeping the module intact avoids a second breaking change bundled into this one. Didn't add a spec for the matchMedia fix -- supports.js computes each property once at module-import time via an IIFE, which doesn't fit this test harness's plain Jasmine-in-real-browser setup without module-mocking machinery this repo doesn't have. The existing menu.js/navigation.js/footer.js specs already exercise the changed addEventListener lines in real Firefox and Chrome (not jsdom), which is the practical coverage available here. Stacked on v23/support-css (browser-support CSS cleanup). Part of #1084. Verified: npm run lint, npm test (47 specs, Firefox + Chrome), and npm run build-package all pass.
stephaniehobson
force-pushed
the
v23/support-js
branch
from
September 17, 2026 19:15
8da390f to
91f835a
Compare
stephaniehobson
marked this pull request as ready for review
September 17, 2026 22:57
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.
Description
Removes the
Element.matches()pollyfill, updatesMzpSupports.matchMedia, removed a IE9classListwork around.I have documented this change in the design system.I have recorded this change in(already covered)CHANGELOG.md.Issue
Part of #1084
Testing
Tests are passing. Give the sticky nav and collapsing components footer a glance, I think they're the most affected.