Problem/Motivation
After we have updated our browser support in #2390621: [policy, no patch] Update Drupal's browser support policy, let's go through our polyfills and determine which browser polyfills are no longer needed.
Proposed resolution
Polyfills that are no longer needed should be deprecated for removal before Drupal 9.
Remaining tasks
Deprecate
#3086379: Deprecate html5shiv and remove usages in core
#3086369: Deprecate matchMedia
#3086375: Deprecate domready and remove usages in core
#2955842: Deprecate classList library
Remove
#3089469: Remove html5shiv in Drupal 9
#3089472: Remove matchmedia in Drupal 9
#3089480: Remove domready in Drupal 9
#3090010: Remove classList in Drupal 9
#3072906: Deprecate and remove jQuery UI datepicker
Comments
Comment #2
xjmThe policy has all the needed signoffs and is just waiting on docs updates, so this can start now!
Comment #3
zrpnrI made a first pass at this, looking over the files in assets/vendor as well as searching for "polyfill" in core.
Polyfills which can be removed
matchmedia
core/matchmediacore/matchmedia.addListenerAdded in: #1815602: Introduce a polyfill for matchMedia
https://caniuse.com/#feat=matchmedia
https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/addListener
Should be supported in IE11 but need additional verification
domready
core/domreadyAdded in #1974580: Introduce domReady to remove jQuery dependency from drupal.js and clean it up.
Only used in drupal.init.js, could be replaced with event listener
https://developer.mozilla.org/en-US/docs/Web/API/Window/DOMContentLoaded...
suggested to remove in https://www.drupal.org/project/drupal/issues/2961308
html5shiv
core/html5shivAdded in: #1077878: Add HTML5shiv to core
https://caniuse.com/#feat=html5semantic
This lists issues with the
mainelement in IE11,I tested the Bartik theme with IE11 and the page seemed to render correctly, and the main element appeared in the dom inspector.
Opera mini treats all semantic elements being "unknown" but "This is easily taken care of by manually setting the default display value for each tag."
Related: #1993334: Add HTML5shiv to Stable and Classy only
Polyfills with open issues to remove/replace
classList
core/classListNot fully supported by IE11
https://developer.mozilla.org/en-US/docs/Web/API/Element/classList
However none of these usages are in Drupal core
open issue to deprecate core/classList: https://www.drupal.org/project/drupal/issues/2955842
input type=date
core/misc/date.es6.jsDeprecate jQuery UI datepicker
#3072906: Deprecate and remove jQuery UI datepicker
dialog
Polyfill HTML5 dialog element with jQueryUI
core/misc/dialog/dialog.es6.jsReplace jQuery UI dialog with supported library or polyfill
#2158943: Add a native dialog element to deprecate the jQuery UI dialog
Farbtastic, inpu type=color
core/farbtastichttps://www.drupal.org/project/drupal/issues/2268955
postponed on: https://www.drupal.org/project/drupal/issues/1651344
http://caniuse.com/#feat=input-color
Polyfills required by current browser support policy
details
core/misc/collapse.es6.js
Polyfill for HTML5 details elements
used by IE11
https://caniuse.com/#feat=details
Related:
core/themes/seven/css/components/entity-meta.css
https://www.drupal.org/node/2493957
picturefill
Polyfill for picture
https://caniuse.com/#search=picture
https://caniuse.com/#feat=srcset
Related: #1883526: Decide on the picture polyfill to use
Comment #4
zrpnrComment #5
zrpnrFarbtastic is also related to #2808151: [policy] Move the Color module to a contributed project when Bartik is deprecated, if color module is moved to contrib then farbtastic could be removed from core as well.
Comment #6
zrpnrComment #7
lauriiiWe should deprecate these polyfills from core, but we should keep them in stable to keep sites intact. Instructions on the deprecation notice message should recommend using the library from Stable, or to remove dependency to it altogether. I recommend the following process for each polyfill:
I agree that we can deprecate and remove
core/matchmedia,core/domreadyandcore/html5shiv.core/classListseems like a fairly small polyfill but I think we could continue on deprecating and removing it since it's not needed by core anymore.Should we deprecate
core/farbtasticand add a copy of the library to color module? This might be also an additional justification for #2808151: [policy] Move the Color module to a contributed project when Bartik is deprecated.Comment #8
xjmThanks everyone! For now, let's consider the Farbtastic discussion a coild-have; it's the same code whether we're moving it (back) into Drupal core or not, and should not affect the BC. We can also do that deprecation during Drupal 9's minors.
Let's go ahead with the deprecations of matchmedia, domready, and html5shiv, and consider at least marking those three deprecated the must-haves to complete by 8.8.0-beta1.
Comment #9
zrpnrThere are green patches in:
#3086379: Deprecate html5shiv and remove usages in core
#3086369: Deprecate matchMedia
#3086375: Deprecate domready and remove usages in core
Comment #11
zrpnrI added contrib modules to replace these asset libraries at
and updated the domready issue per feedback from @lauriii
Comment #12
lauriiiThe policy states that the polyfills that are no longer needed, will be removed as part of a major release. Does this mean that we can remove the polyfill from being loaded before that as part of a minor release, or do we have to keep loading the polyfill by default till the major version ships?
Comment #13
lauriiiTalked about #12 with @catch and we agreed that the steps we should be taking on the polyfill removals are:
This means that the contrib modules will have to be written in a way that ensures that the library isn't loaded twice.
Comment #14
xjmI agree with #13.
Comment #15
zrpnrhtml5shiv and matchmedia now are simpler patches, they just add the deprecation message.
domready still removes any usages in core and marks the library deprecated.
I also updated the 2 contrib modules per @lauriii feedback
The change records for html5shiv and matchmedia now have a link to their contrib projects.
Comment #16
xjmComment #17
xjmAll three polyfills are now deprecated, so all that remains to actually remove them in 9.0.x (probably actually more work). ;)
Comment #18
zrpnrAdded the 3 child issues for removing these polyfills from Drupal 9, and they all have patches ready for review.
Comment #19
zrpnrThe issues to deprecate html5shiv, matchMedia, domready and classList are fixed,
The issue to remove html5shiv is fixed, and matchMedia, domready and classList are RTBC.
Updated the IS.
Comment #20
zrpnrUpdated IS now that #3072906: Deprecate and remove jQuery UI datepicker is deprecated in 8.8 and 8.9, and removed from 9.0
Comment #21
gábor hojtsyAll of the children are now done. Congrats and thanks!
Comment #22
xjmAll child issues have been fixed so we can mark this fixed too. Yay!
Comment #23
xjmUhh and that's me crossposting four days later. Sorry. :D