Skip to content
This repository has been archived by the owner on Nov 21, 2023. It is now read-only.

Commit

Permalink
Add polyfills for IE11
Browse files Browse the repository at this point in the history
  • Loading branch information
dotherightthing committed Jan 7, 2021
1 parent 5acf5b2 commit 95422e9
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions js/_frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,27 @@ const wpdtrtAnchorlinksUi = {
return $(`.wpdtrt-anchorlinks__list-link[href='#${$(el).attr('id')}']`);
},

/**
* @function initPolyfills
* @memberof wpdtrtAnchorlinksUi
* @protected
*/
initPolyfill: () => {
/* eslint-disable */

// Polyfill for forEach
if (window.NodeList && !NodeList.prototype.forEach) {
NodeList.prototype.forEach = Array.prototype.forEach;
}

// Polyfill for forEach
if (window.HTMLCollection && !HTMLCollection.prototype.forEach) {
HTMLCollection.prototype.forEach = Array.prototype.forEach;
}

/* eslint-enable */
},

/**
* @function setTitleToSummary
* @summary Inject the summary section (outside of the page content) into the nav.
Expand Down Expand Up @@ -272,6 +293,8 @@ const wpdtrtAnchorlinksUi = {
sticky_jump_menu: ($jumpMenu) => {
const $ = wpdtrtAnchorlinksUi.jQuery;

wpdtrtAnchorlinksUi.initPolyfill();

if (!$jumpMenu.length) {
return;
}
Expand Down

0 comments on commit 95422e9

Please sign in to comment.