From c6a1f2a3ce62c8b96f055766996ae628b1ed6a04 Mon Sep 17 00:00:00 2001 From: Rob Jacobs Date: Tue, 8 Aug 2017 10:40:09 -0400 Subject: [PATCH] fix(demos): Convert NodeList to array for forEach; avoid fat arrow (#1073) This resolves issues in the slider and snackbar demos for IE 11 and Edge. --- demos/slider.html | 9 +++------ demos/snackbar.html | 3 +-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/demos/slider.html b/demos/slider.html index 3c3e326ac1d..9ca95c366c6 100644 --- a/demos/slider.html +++ b/demos/slider.html @@ -288,8 +288,7 @@

Discrete Slider with markers

}); darkTheme.addEventListener('change', function() { - var examples = demoRoot.querySelectorAll('.example-slider-wrapper'); - examples.forEach((example) => { + [].slice.call(demoRoot.querySelectorAll('.example-slider-wrapper')).forEach(function(example) { example.classList[ darkTheme.checked ? 'add' : 'remove']('mdc-theme--dark'); }); }); @@ -301,15 +300,13 @@

Discrete Slider with markers

}); useCustomColor.addEventListener('change', function() { - var examples = demoRoot.querySelectorAll('.example-slider-wrapper'); - examples.forEach((example) => { + [].slice.call(demoRoot.querySelectorAll('.example-slider-wrapper')).forEach(function(example) { example.classList[ useCustomColor.checked ? 'add' : 'remove' ]('custom-bg'); }); }); rtl.addEventListener('change', function() { - var examples = demoRoot.querySelectorAll('.example-slider-wrapper'); - examples.forEach((example) => { + [].slice.call(demoRoot.querySelectorAll('.example-slider-wrapper')).forEach(function(example) { if (rtl.checked) { example.setAttribute('dir', 'rtl'); } else { diff --git a/demos/snackbar.html b/demos/snackbar.html index d1e8c0b673a..2f58a0ae123 100644 --- a/demos/snackbar.html +++ b/demos/snackbar.html @@ -213,7 +213,6 @@

Basic Example

var actionOnBottomInput = document.getElementById('action-on-bottom'); var actionOnBottomCheckbox = document.getElementById('action-on-bottom-checkbox'); var dismissOnActionInput = document.getElementById('dismiss-on-action'); - var textFields = document.querySelectorAll('.mdc-textfield'); // Since Action on Bottom cannot be checked if Multi-line Input // is not, we start with a disabled Action on Bottom option @@ -271,7 +270,7 @@

Basic Example

document.body.classList.contains('mdc-theme--dark') ? document.body.classList.remove('mdc-theme--dark') : document.body.classList.add('mdc-theme--dark'); }); - textFields.forEach(function(tf) { + [].slice.call(document.querySelectorAll('.mdc-textfield')).forEach(function(tf) { mdc.textfield.MDCTextfield.attachTo(tf); })