Remove support for legacy IE - #5834
Merged
Merged
Conversation
This officially drops support for Internet Explorer 8, since this method is not provided by that browser. This is one more step closer to removing the dependency on jQuery itself.
Now that we no longer support IE8, we can rely on this method actually existing now.
This has long been unsupported, and now that we don't care about IE8 with quirks mode, we can go back to expecting that `getAttribute` actually returns the string like it is supposed to.
This also simplifies the logic used to use more modern array methods to calculate the list of classes which need to be copied over to the destination object.
This replaces calls to the jQuery `getClass`, `hasClass`, and `removeClass` methods with the corresponding calls to `classList` methods on the elements that are referenced. There is one exception to this, specifically where results remove a class from any elements which may contain it, since that cannot be easily translated to use the `classList` syntax.
This removes the legacy tracking for `onpropertychange`, which was used by IE 8, to synchronize attribute changes from the `<select>` element back to Select2. This removes the legacy tracking of `DOMNodeInserted`, `DOMNodeRemoved`, and `DOMAttrModified` which was used by IE 9 and IE 10 for tracking when `<option>` elements were added and removed, as well as when attributes on the `<select>` element were synchronized. Now only the `MutationObserver` is in use for synchronizing changes to the `<select>` as well as changes to the `<option>` elements that it contains.
kevin-brown
marked this pull request as ready for review
April 19, 2020 22:56
maxwellfet928
pushed a commit
to maxwellfet928/select2
that referenced
this pull request
Jun 8, 2026
* Replace usage of $.trim with String.prototype.trim This officially drops support for Internet Explorer 8, since this method is not provided by that browser. This is one more step closer to removing the dependency on jQuery itself. * Replace $.isArray with Array.isArray Now that we no longer support IE8, we can rely on this method actually existing now. * Remove old getAttribute workaround for IE7 This has long been unsupported, and now that we don't care about IE8 with quirks mode, we can go back to expecting that `getAttribute` actually returns the string like it is supposed to. * Remove jQuery from Utils.copyNonInternalCssClasses This also simplifies the logic used to use more modern array methods to calculate the list of classes which need to be copied over to the destination object. * Remove unused imports * Remove use of jQuery.fn.is() * Replace $.inArray with Array.prototype.indexOf * Replace addClass, hasClass, removeClass with classList calls This replaces calls to the jQuery `getClass`, `hasClass`, and `removeClass` methods with the corresponding calls to `classList` methods on the elements that are referenced. There is one exception to this, specifically where results remove a class from any elements which may contain it, since that cannot be easily translated to use the `classList` syntax. * Remove legacy DOM modification tracking This removes the legacy tracking for `onpropertychange`, which was used by IE 8, to synchronize attribute changes from the `<select>` element back to Select2. This removes the legacy tracking of `DOMNodeInserted`, `DOMNodeRemoved`, and `DOMAttrModified` which was used by IE 9 and IE 10 for tracking when `<option>` elements were added and removed, as well as when attributes on the `<select>` element were synchronized. Now only the `MutationObserver` is in use for synchronizing changes to the `<select>` as well as changes to the `<option>` elements that it contains. * Replace $.map with Array.prototype.map
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.
This officially drops support for Internet Explorer 10 and below.
This pull request includes a
The following changes were made
$.trimwithString.prototype.trim$.isArraywithArray.isArray$.fn.is(tagName)withElement.prototype.tagName$.inArraywithArray.prototype.indexOf$.fn.addClasswithclassList.add$.fn.hasClasswithclassList.contains$.fn.removeClasswithclassList.remove$.mapwithArray.prototype.mapIf this is related to an existing ticket, include a link to it as well.
Fixes #4496