Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Unified Diff: third_party/polymer/v1_0/components-chromium/paper-ripple/paper-ripple-extracted.js

Issue 2089563002: [Polymer] update polymer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: polymer update Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/polymer/v1_0/components-chromium/paper-ripple/paper-ripple-extracted.js
diff --git a/third_party/polymer/v1_0/components-chromium/paper-ripple/paper-ripple-extracted.js b/third_party/polymer/v1_0/components-chromium/paper-ripple/paper-ripple-extracted.js
index b5b233bf4eb8e7271272cc94fc90babbea055233..ee1afff6e965c54f303f9c94e63f7e79bdc90196 100644
--- a/third_party/polymer/v1_0/components-chromium/paper-ripple/paper-ripple-extracted.js
+++ b/third_party/polymer/v1_0/components-chromium/paper-ripple/paper-ripple-extracted.js
@@ -400,16 +400,7 @@
},
get target () {
- var ownerRoot = Polymer.dom(this).getOwnerRoot();
- var target;
-
- if (this.parentNode.nodeType == 11) { // DOCUMENT_FRAGMENT_NODE
- target = ownerRoot.host;
- } else {
- target = this.parentNode;
- }
-
- return target;
+ return this.keyEventTarget;
},
keyBindings: {
@@ -422,14 +413,20 @@
// Set up a11yKeysBehavior to listen to key events on the target,
// so that space and enter activate the ripple even if the target doesn't
// handle key events. The key handlers deal with `noink` themselves.
- this.keyEventTarget = this.target;
- this.listen(this.target, 'up', 'uiUpAction');
- this.listen(this.target, 'down', 'uiDownAction');
+ if (this.parentNode.nodeType == 11) { // DOCUMENT_FRAGMENT_NODE
+ this.keyEventTarget = Polymer.dom(this).getOwnerRoot().host;
+ } else {
+ this.keyEventTarget = this.parentNode;
+ }
+ var keyEventTarget = /** @type {!EventTarget} */ (this.keyEventTarget);
+ this.listen(keyEventTarget, 'up', 'uiUpAction');
+ this.listen(keyEventTarget, 'down', 'uiDownAction');
},
detached: function() {
- this.unlisten(this.target, 'up', 'uiUpAction');
- this.unlisten(this.target, 'down', 'uiDownAction');
+ this.unlisten(this.keyEventTarget, 'up', 'uiUpAction');
+ this.unlisten(this.keyEventTarget, 'down', 'uiDownAction');
+ this.keyEventTarget = null;
},
get shouldKeepAnimating () {
@@ -477,6 +474,7 @@
ripple.downAction(event);
if (!this._animating) {
+ this._animating = true;
this.animate();
}
},
@@ -506,6 +504,7 @@
ripple.upAction(event);
});
+ this._animating = true;
this.animate();
},
@@ -544,11 +543,12 @@
},
animate: function() {
+ if (!this._animating) {
+ return;
+ }
var index;
var ripple;
- this._animating = true;
-
for (index = 0; index < this.ripples.length; ++index) {
ripple = this.ripples[index];
@@ -593,5 +593,14 @@
this.upAction();
}
}
+
+ /**
+ Fired when the animation finishes.
+ This is useful if you want to wait until
+ the ripple animation finishes to perform some action.
+
+ @event transitionend
+ @param {{node: Object}} detail Contains the animated node.
+ */
});
})();

Powered by Google App Engine
This is Rietveld 408576698