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

Commit

Permalink
fix(demos): Correct RTL/LTR toggling in demos in Safari (#2348)
Browse files Browse the repository at this point in the history
  • Loading branch information
swashcap authored and kfranqueiro committed Mar 6, 2018
1 parent ab85736 commit b9000a4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 1 addition & 5 deletions demos/card.html
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,7 @@ <h2 class="demo-card-article__title mdc-typography--headline">Asia's clean energ
var rtlToggle = document.getElementById('toggle-rtl');
rtlToggle.addEventListener('change', function() {
var docEl = document.documentElement;
if (rtlToggle.checked) {
docEl.setAttribute('dir', 'rtl');
} else {
docEl.removeAttribute('dir');
}
docEl.setAttribute('dir', rtlToggle.checked ? 'rtl' : 'ltr');
});

[].forEach.call(document.querySelectorAll('.mdc-button'), function(surface) {
Expand Down
2 changes: 1 addition & 1 deletion demos/top-app-bar.html
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ <h3>Demo Controls</h3>
});

rtlCheckbox.addEventListener('change', function() {
document.body[this.checked ? 'setAttribute' : 'removeAttribute']("dir", "rtl");
document.body.setAttribute('dir', this.checked ? 'rtl': 'ltr');
appBarEl.classList.remove('mdc-top-app-bar--short-has-action-item');

appBar.destroy();
Expand Down

0 comments on commit b9000a4

Please sign in to comment.