Skip to content

Commit

Permalink
fix(demos): Fix NPEs in drawer demos (#1946)
Browse files Browse the repository at this point in the history
To repro:

1. View the [Temporary Drawer demo page](https://material-components-web.appspot.com/drawer/temporary-drawer.html) in any browser
2. Open the dev tools
3. Open the drawer by clicking on the toolbar menu icon
4. Click on a blank part of the drawer (NOT on a list item)
  • Loading branch information
acdvorak authored Jan 16, 2018
1 parent 0b4b870 commit 2c92827
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions demos/drawer/permanent-drawer-above-toolbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ <h1 class="mdc-typography--display1">Permanent Drawer</h1>
var activatedClass = 'mdc-list-item--selected';
document.querySelector('.mdc-drawer').addEventListener('click', function(event) {
var el = event.target;
while (!el.classList.contains('mdc-list-item') && el) {
el = el.parentNode;
while (el && !el.classList.contains('mdc-list-item')) {
el = el.parentElement;
}
if (el) {
var activatedItem = document.querySelector('.' + activatedClass);
Expand Down
4 changes: 2 additions & 2 deletions demos/drawer/permanent-drawer-below-toolbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ <h1 class="mdc-typography--display1">Permanent Drawer</h1>
var activatedClass = 'mdc-list-item--selected';
document.querySelector('.mdc-drawer').addEventListener('click', function(event) {
var el = event.target;
while (!el.classList.contains('mdc-list-item') && el) {
el = el.parentNode;
while (el && !el.classList.contains('mdc-list-item')) {
el = el.parentElement;
}
if (el) {
var activatedItem = document.querySelector('.' + activatedClass);
Expand Down
4 changes: 2 additions & 2 deletions demos/drawer/persistent-drawer.html
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ <h1 class="mdc-typography--display1">Persistent Drawer</h1>
var activatedClass = 'mdc-list-item--selected';
document.querySelector('.mdc-drawer__drawer').addEventListener('click', function(event) {
var el = event.target;
while (!el.classList.contains('mdc-list-item') && el) {
el = el.parentNode;
while (el && !el.classList.contains('mdc-list-item')) {
el = el.parentElement;
}
if (el) {
var activatedItem = document.querySelector('.' + activatedClass);
Expand Down
4 changes: 2 additions & 2 deletions demos/drawer/temporary-drawer.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ <h1 class="mdc-typography--display1">Temporary Drawer</h1>
var activatedClass = 'mdc-list-item--selected';
document.querySelector('.mdc-drawer__drawer').addEventListener('click', function(event) {
var el = event.target;
while (!el.classList.contains('mdc-list-item') && el) {
el = el.parentNode;
while (el && !el.classList.contains('mdc-list-item')) {
el = el.parentElement;
}
if (el) {
var activatedItem = document.querySelector('.' + activatedClass);
Expand Down

0 comments on commit 2c92827

Please sign in to comment.