Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 292977

Add JavaScript polyfill for NodeList.forEach

$
0
0

Problem/Motivation

The syntax for looping over a NodeList using the forEach method is more concise and useful but is not supported in older browsers, specifically IE11.

As Drupal core uses less and less jQuery to manipulate the DOM, see: #3052002: Replace JQuery with vanilla Javascript in core
it's likely that vanilla JavaScript methods like querySelectorAll or childNodes will be more commonly used by developers.

Proposed resolution

In https://www.drupal.org/project/drupal/issues/3064049#comment-13269867
@justafish suggested using a polyfill like https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach#Polyfill

Remaining tasks

1. Decide where to add the polyfill, for example:

2. Create the polyfill and test in IE11.


Viewing all articles
Browse latest Browse all 292977

Trending Articles