Skip to content

Commit

Permalink
Make sure event.path is an array
Browse files Browse the repository at this point in the history
Can be a NodeList on older Chromes
  • Loading branch information
dfreedm committed Mar 8, 2016
1 parent 8066919 commit 2dfdd7b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib/dom-api-event.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@
},

get path() {
return this.event.path;
var path = this.event.path;
if (!Array.isArray(path)) {
path = Array.prototype.slice.call(path);
}
return path;
}

};
Expand Down
4 changes: 4 additions & 0 deletions test/unit/polymer-dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,10 @@ suite('Polymer.dom', function() {
assert.equal(path[2], re);
assert.equal(path[4], rere);
assert.equal(path[6], testElement);
// event.path *should* be an array
assert.isArray(path);
assert.isFunction(path.indexOf);
assert(path.indexOf(testElement) > -1);
});

rere.addEventListener('test-event', function(e) {
Expand Down

0 comments on commit 2dfdd7b

Please sign in to comment.