Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
fix(demos): Convert NodeList to array for forEach; avoid fat arrow (#…
Browse files Browse the repository at this point in the history
…1073)

This resolves issues in the slider and snackbar demos for IE 11 and Edge.
  • Loading branch information
RobJacobs authored and kfranqueiro committed Aug 8, 2017
1 parent eb35255 commit c6a1f2a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
9 changes: 3 additions & 6 deletions demos/slider.html
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,7 @@ <h2>Discrete Slider with markers</h2>
});

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');
});
});
Expand All @@ -301,15 +300,13 @@ <h2>Discrete Slider with markers</h2>
});

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 {
Expand Down
3 changes: 1 addition & 2 deletions demos/snackbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ <h2 class="mdc-typography--title">Basic Example</h2>
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
Expand Down Expand Up @@ -271,7 +270,7 @@ <h2 class="mdc-typography--title">Basic Example</h2>
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);
})

Expand Down

0 comments on commit c6a1f2a

Please sign in to comment.