mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-11 10:28:41 -04:00
Replace use of Array.from
Array.from isn't supported by any version of IE. We still need to convert a nodelist to an array so we can either: 1. include the polyfill for Array.from from core-js 2. use [].slice We don't use Array.from anywhere else so this uses the second one.
This commit is contained in:
@@ -29,9 +29,10 @@
|
|||||||
|
|
||||||
this.getRangeFromElement = function (keyElement) {
|
this.getRangeFromElement = function (keyElement) {
|
||||||
const range = document.createRange();
|
const range = document.createRange();
|
||||||
|
const childNodes = Array.prototype.slice.call(keyElement.childNodes);
|
||||||
let prefixIndex = -1;
|
let prefixIndex = -1;
|
||||||
|
|
||||||
Array.from(keyElement.childNodes).forEach((el, idx) => {
|
childNodes.forEach((el, idx) => {
|
||||||
if ((el.nodeType === 1) && el.classList.contains('govuk-visually-hidden')) {
|
if ((el.nodeType === 1) && el.classList.contains('govuk-visually-hidden')) {
|
||||||
prefixIndex = idx;
|
prefixIndex = idx;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user