Opened 11 months ago
Last modified 12 days ago
#64278 new task (blessed)
Remove remaining Internet Explorer code
| Reported by: | joedolson | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.2 |
| Component: | General | Version: | 6.9 |
| Severity: | minor | Keywords: | has-patch |
| Cc: | Focuses: | javascript, css |
Description
No version of Internet Explorer is still supported by WordPress, but miscellaneous scripts still contain hacks and workarounds to support it. This ticket is to track instances and resolve them.
Known examples:
- Dashed border fix in
imgareaselectLine 405 - Rest selection area positions in
imgareaselectLine 350 - Fix background PNGs in
farbtasticLine 38 - Thickbox hacks Line 47, also line 301, 310
- TinyMCE skins effecting galleries and gallery items
- Early exit on autoresize textarea in dashboard.js Line 202
- Early exit in customize/controls.js for IE9
- tinymce/plugins/wordpress/plugin.js setting body classes
- Check whether document.msHidden is present in heartbeat.js
- emoji.js browser checks
- twentytwentyone/assets/js/polyfills.js
- gruntfile.js css minification compatibility
- some settings in wp-admin/css/forms.css that are IE specific
- use classlist methods in twentynineteen/js/touch-keyboard-navigation.js & priority-menu.js
- timezone methods in dashboard.js
This is just a rough look at some of the possible issues. None of these are particularly important, but it would enable us to clean up the codebase in a variety of ways by removing exceptions.
Attachments (1)
Change History (6)
@
11 months ago
Remove Legacy Internet Explorer-Specific Code and Clean Up Outdated Scripts in WordPress
#2
@
11 months ago
- Keywords has-patch added
- Version → trunk
This patch removes legacy Internet Explorer (IE) specific code and cleans up outdated scripts in WordPress, ensuring compatibility with modern browsers.
Changes Made:
- Removed IE-specific hacks in JavaScript and CSS files (e.g., imgareaselect, farbtastic, thickbox, tinymce, heartbeat.js, emoji.js, dashboard.js).
- Cleaned up IE-specific polyfills and workarounds in theme files (twenty-nineteen, twenty-twenty-one).
- Refactored code in functions.php and polyfills.js to remove unnecessary IE support.
#3
@
8 months ago
- Keywords has-patch removed
This can be an 'umbrella' or 'parent' ticket for tracking smaller tickets. The phase-out plan said that "individual tickets should be created to evaluate removing each instance of IE11 specific code."
Some admin scripts still might make sense to combine, but at least the front-end changes could have their own tickets.
- Twenty Twenty-One is quite complex, so I created #64590 and its pull request to run the automated tests.
- Twenty Nineteen scripts
- Emoji script
This ticket was mentioned in PR #13959 on WordPress/wordpress-develop by @vidugupta.
12 days ago
#5
- Keywords has-patch added
Problem
A few first-party admin scripts still carry workarounds for Internet Explorer, which WordPress no longer supports:
heartbeat.jsfalls back to the IE10-onlymsHidden/msvisibilitychangePage Visibility API.customize/controls.jsguardspopulateChangesetUuidParam()against IE9, which lackshistory.replaceState.dashboard.jsexitsautoResizeTextarea()early whendocument.documentMode < 9(IE8 or older).
Root Cause
These fallbacks were added when IE9 to IE11 were supported browsers. IE is now outside the supported browser baseline (browserslist in package.json lists only current Chrome, Firefox, Safari, Edge, Opera and mobile browsers), so the branches can never run in a supported browser. The standard APIs they replaced (document.hidden, history.replaceState, modern layout) are available in every supported browser.
Solution
heartbeat.js: removed themsHiddenIE10 branch and dropped "IE < 10" from the comment above it. ThewebkitHiddenbranch is kept, because it is for older Android and not IE.customize/controls.js: removed theif ( ! history.replaceState ) { return; }guard and its comment.dashboard.js: removed thedocument.documentModeearly exit and its comment.
Not included, and left for separate tickets:
- Vendor files (
imgareaselect,thickbox). - The
Gruntfile.jscompatibility: 'ie11'setting. - The
-ms-rules informs.css, some of which Chromium Edge still uses. - The TinyMCE
ie7/ie8/ie9body classes. - The "IE11" timezone fallback in
dashboard.js, which may serve other cases.
Example Usage
// BEFORE: IE-only branch in the Page Visibility detection. } else if ( typeof document.msHidden !== 'undefined' ) { // IE10. hidden = 'msHidden'; visibilitychange = 'msvisibilitychange'; visibilityState = 'msVisibilityState'; } else if ( typeof document.webkitHidden !== 'undefined' ) { // Android.
// AFTER: the standard API is used, with the Android fallback kept. } else if ( typeof document.webkitHidden !== 'undefined' ) { // Android.
Impact
- No behavior change in any supported browser.
- Removes 15 lines of dead code and one stale browser reference from a comment.
- Checked:
npx eslintpasses on all three files, and no QUnit test references the removed code. - Not checked locally: the QUnit suite could not run, and I did not manually test Heartbeat, the Customizer
changeset_uuidURL parameter or the Dashboard widgets in a browser. Please verify those in review or CI.
Trac Link
Trac ticket: https://core.trac.wordpress.org/ticket/NNNNN
Parent: https://core.trac.wordpress.org/ticket/64278
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
This is a very good idea.