Problem/Motivation

Since 8.4 release core drop support for IE 9-10 CR https://www.drupal.org/node/2897971
IE11 quirks are not used in "active-link" library https://caniuse.com/#search=classList

Proposed resolution

Deprecate classList asset library to allow for the removal in Drupal 9.

Remaining tasks

- review patch and commit

User interface changes

No

API changes

No

Data model changes

No

Release notes snippet

Deprecated classList polyfill.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

andypost created an issue. See original summary.

andypost’s picture

Status: Active » Needs review
FileSize
318 bytes

Patch removes usage, not sure it needs CR

The only usage in core - that proofs that core libraries does not affected by IE11 quirks

core/misc/active-link.es6.js:51:        activeLinks[i].classList.add('is-active');
core/misc/active-link.es6.js:59:          activeLinks[i].classList.remove('is-active');
core/misc/active-link.js:34:        activeLinks[i].classList.add('is-active');
core/misc/active-link.js:42:          activeLinks[i].classList.remove('is-active');
core/profiles/demo_umami/themes/umami/js/components/navigation/menu-main/menu-main.es6.js:11:     toggler.classList.toggle('menu-main-toggle--active');
core/profiles/demo_umami/themes/umami/js/components/navigation/menu-main/menu-main.es6.js:12:     menu.classList.toggle('menu-main--active');
core/profiles/demo_umami/themes/umami/js/components/navigation/menu-main/menu-main.js:13:    toggler.classList.toggle('menu-main-toggle--active');
core/profiles/demo_umami/themes/umami/js/components/navigation/menu-main/menu-main.js:14:    menu.classList.toggle('menu-main--active');
nod_’s picture

Status: Needs review » Reviewed & tested by the community

looks good to me

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs change record

I think this should be added to the IE 9-10 CR https://www.drupal.org/node/2897971 and also this needs it's own CR for 8.6.x because it is possible that someone has added a library that depends on drupal.active-link and is depending on its classlist dependency for ie 9/10 support. In that instance they need to add the classlist dependency to their library.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

gapple’s picture

Issue tags: +IE9

I've created an issue on the IE9 compatibility module, which could alter the library to restore this dependency for sites that need it #3043990: classList JS library, and could provide its own classList library in the future when it's removed from core.

andypost’s picture

Title: Remove dependency of classList from drupal.active-link library » Deprecate classList library and remove usage

Filed patch to test deprecation in #2951857-11: Update classList.js to 1.2.20180112
But I think it should be marked as duplicate of this issue

andypost’s picture

Status: Needs work » Needs review
FileSize
614 bytes
773 bytes

Patch deprecates library and second one removes usage, needs deprecation test

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

zrpnr’s picture

The patch in #9 looks perfect, I just re-rolled it against 8.9.x and removed the single quotes.
The only other change is the link in the deprecation notice should point to the CR for this issue, I created a quick draft change record optimistically hoping this can still make it into 8.8, and updated that url in the patch.

bnjmnm’s picture

Status: Needs review » Needs work
  1. Shouldn't this require an addition to \Drupal\Tests\Listeners\DeprecationListenerTrait::getSkippedDeprecations?
  2. Although there is an issue for the IE9 compatibility module, there are enough IE11 limitations to justify the polyfill getting its own contrib module in case there are custom modules/themes assuming these capabilities regardless of browser.
    1.Does not have support for classList on SVG or MathML elements.
    2. Does not support the second parameter for the toggle method
    3. Does not support multiple parameters for the add() & remove() methods
    4. Does not support assign to classList or the replace() method

    (better to have the contrib available that never gets used than not having a solution available)

  3. The change record should document how this could potentially impact IE11
  4. This should also get a release notes snippet.
zrpnr’s picture

Issue summary: View changes

#12.1 I don't think it does- unless the library is a dependency you don't get that warning so there's no need to suppress it.
#12.2 Looked again for these specific IE11 limitations, now that #3074267: Replace jQuery UI position() with PopperJS is landed there's a use of classList.toggle with a 2nd parameter in core/modules/quickedit/js/views/EntityToolbarView.es6.js
A contrib module would be a good idea but we also don't want to break an existing feature for IE11.

#10.3 Made a quick note in the CR but I'll update again once the contrib module is released.
#10.4 Added a release note to the IS

bnjmnm’s picture

Looks like some of my feedback from #12 is irrelevant as I just noticed that this polyfill is loaded conditionally
browsers: { IE: 'lte IE 9', '!IE': false }, so this never polyfilled IE11 to begin with.

With that in mind, it's also worth noting that Quickedit uses a second param with classList.toggle(). This was a recent addition to core as part of adding the PopperJS library. This may mean this polyfill can't be deprecated, and actually needs to be loaded on more browsers.

bnjmnm’s picture

Issue tags: +Needs followup

A followup should be created to refactor the use of classList.toggle() with a second argument in Quickedit's EntityToolBarView to instead use a conditional that determines if add() or remove() is called, as opposed to using the param in toggle() to determine if the class is added or removed.

The IE11 specific stuff in the CR and RN I requested can be removed since we've since realized the polyfill is conditionally loaded.

zrpnr’s picture

Status: Needs work » Needs review
Issue tags: -Needs followup

The IE11 specific stuff in the CR and RN I requested can be removed since we've since realized the polyfill is conditionally loaded.

I agree, the polyfill is not currently loaded for IE11 so removing the polyfill won't make any difference.
The info about IE11 in the CR still seems useful, but I changed the wording to explain that the polyfill was only applied to IE9 and below.

A followup should be created to refactor the use of classList.toggle() with a second argument in Quickedit's EntityToolBarView to instead use a conditional that determines if add() or remove() is called, as opposed to using the param in toggle() to determine if the class is added or removed.

Better to address that existing browser bug separately than to block this issue. Created #3089752: Follow-up to #3074267 Refactor use of classList in quickedit for browser compatibility

Setting this back to NR

bnjmnm’s picture

Status: Needs review » Reviewed & tested by the community
alexpott’s picture

Discussed with @catch and we both feel this patch is good for 8.8.x BUT on close reading of #3086379: Deprecate html5shiv and remove usages in core that patch deprecated Html5Shiv which is only loaded in IE8 and less but did not remove core usages. Which is a different approach than this patch takes. Going to get @lauriii's opinion as frontend framework manager.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: -Needs frontend framework manager review

Discussed further with @catch - let's add the deprecation but also add it to getSkippedDeprecations() ala #3086379: Deprecate html5shiv and remove usages in core and then file a follow-up issue to actually do the removal in Drupal 9.0.0

As @catch said

if there are sites out there trying to support these older versions, we shouldn't actively break their attempts until 9.x

zrpnr’s picture

Status: Needs work » Needs review
FileSize
1.63 KB
1.14 KB

that patch deprecated Html5Shiv which is only loaded in IE8 and less but did not remove core usages. Which is a different approach than this patch takes.

That makes sense- just like html5shiv and matchmedia and domready there can be a Drupal 9 issue to actually remove the usage while this patch just gets the deprecation in.

Restored dependency to active-link
Added the warning suppression since it would cause a warning in LanguageSwitchingTest.

zrpnr’s picture

Title: Deprecate classList library and remove usage » Deprecate classList library
Issue summary: View changes
andypost’s picture

Status: Needs review » Reviewed & tested by the community

Let's get it in!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 592b6ae and pushed to 9.0.x. Thanks!
Committed and pushed d5fc5da747 to 8.9.x and 1bfa7c6dfc to 8.8.x. Thanks!

Now we can remove classlist completely from Drupal 9.

  • alexpott committed 592b6ae on 9.0.x
    Issue #2955842 by andypost, zrpnr, bnjmnm, alexpott, gapple: Deprecate...

  • alexpott committed d5fc5da on 8.9.x
    Issue #2955842 by andypost, zrpnr, bnjmnm, alexpott, gapple: Deprecate...

  • alexpott committed 1bfa7c6 on 8.8.x
    Issue #2955842 by andypost, zrpnr, bnjmnm, alexpott, gapple: Deprecate...
alexpott’s picture

Issue tags: +8.8.0 release notes

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.