mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Replace support for event.path.
This commit is contained in:
@@ -320,6 +320,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
get localTarget() {
|
||||
return this.event.target;
|
||||
}
|
||||
|
||||
get path() {
|
||||
return this.event.composedPath();
|
||||
}
|
||||
}
|
||||
|
||||
Polymer.dom = function(obj) {
|
||||
|
||||
@@ -253,6 +253,24 @@ suite('ShadyDOM event patching', function() {
|
||||
assert.equal(el.events[0], el.$.child);
|
||||
assert.equal(el.events[1], el);
|
||||
});
|
||||
|
||||
test('Polymer.dom events', function(done) {
|
||||
var el = fixture('scoped');
|
||||
el.addEventListener('composed', function(e) {
|
||||
assert.equal(Polymer.dom(e).rootTarget, el.$.scoped);
|
||||
assert.equal(Polymer.dom(e).localTarget, el);
|
||||
let nodes = [];
|
||||
let p = el.$.scoped;
|
||||
while (p) {
|
||||
nodes.push(p);
|
||||
p = p.parentNode || p.host;
|
||||
}
|
||||
nodes.push(window);
|
||||
assert.deepEqual(Array.from(Polymer.dom(e).path), nodes);
|
||||
done();
|
||||
});
|
||||
el.fireComposed();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user