Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 Polymer({ | 1 Polymer({ |
| 2 is: 'paper-tooltip', | 2 is: 'paper-tooltip', |
| 3 | 3 |
| 4 hostAttributes: { | 4 hostAttributes: { |
| 5 role: 'tooltip', | 5 role: 'tooltip', |
| 6 tabindex: -1 | 6 tabindex: -1 |
| 7 }, | 7 }, |
| 8 | 8 |
| 9 behaviors: [ | 9 behaviors: [ |
| 10 Polymer.NeonAnimationRunnerBehavior | 10 Polymer.NeonAnimationRunnerBehavior |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 }, | 97 }, |
| 98 | 98 |
| 99 _showing: { | 99 _showing: { |
| 100 type: Boolean, | 100 type: Boolean, |
| 101 value: false | 101 value: false |
| 102 } | 102 } |
| 103 }, | 103 }, |
| 104 | 104 |
| 105 listeners: { | 105 listeners: { |
| 106 'neon-animation-finish': '_onAnimationFinish', | 106 'neon-animation-finish': '_onAnimationFinish', |
| 107 'mouseenter': 'hide' | |
| 108 }, | 107 }, |
| 109 | 108 |
| 110 /** | 109 /** |
| 111 * Returns the target element that this tooltip is anchored to. It is | 110 * Returns the target element that this tooltip is anchored to. It is |
| 112 * either the element given by the `for` attribute, or the immediate paren t | 111 * either the element given by the `for` attribute, or the immediate paren t |
| 113 * of the tooltip. | 112 * of the tooltip. |
| 114 */ | 113 */ |
| 115 get target () { | 114 get target () { |
| 116 var parentNode = Polymer.dom(this).parentNode; | 115 var parentNode = Polymer.dom(this).parentNode; |
| 117 // If the parentNode is a document fragment, then we need to use the hos t. | 116 // If the parentNode is a document fragment, then we need to use the hos t. |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 132 this._target = this.target; | 131 this._target = this.target; |
| 133 | 132 |
| 134 if (this.manualMode) | 133 if (this.manualMode) |
| 135 return; | 134 return; |
| 136 | 135 |
| 137 this.listen(this._target, 'mouseenter', 'show'); | 136 this.listen(this._target, 'mouseenter', 'show'); |
| 138 this.listen(this._target, 'focus', 'show'); | 137 this.listen(this._target, 'focus', 'show'); |
| 139 this.listen(this._target, 'mouseleave', 'hide'); | 138 this.listen(this._target, 'mouseleave', 'hide'); |
| 140 this.listen(this._target, 'blur', 'hide'); | 139 this.listen(this._target, 'blur', 'hide'); |
| 141 this.listen(this._target, 'tap', 'hide'); | 140 this.listen(this._target, 'tap', 'hide'); |
| 141 this.listen(this, 'mouseenter', 'hide'); | |
|
Dan Beam
2016/08/25 01:24:43
this already landed in Polymer, I just don't reall
tsergeant
2016/08/25 04:51:00
Acknowledged.
| |
| 142 }, | 142 }, |
| 143 | 143 |
| 144 detached: function() { | 144 detached: function() { |
| 145 if (this._target && !this.manualMode) { | 145 if (this._target && !this.manualMode) { |
| 146 this.unlisten(this._target, 'mouseenter', 'show'); | 146 this.unlisten(this._target, 'mouseenter', 'show'); |
| 147 this.unlisten(this._target, 'focus', 'show'); | 147 this.unlisten(this._target, 'focus', 'show'); |
| 148 this.unlisten(this._target, 'mouseleave', 'hide'); | 148 this.unlisten(this._target, 'mouseleave', 'hide'); |
| 149 this.unlisten(this._target, 'blur', 'hide'); | 149 this.unlisten(this._target, 'blur', 'hide'); |
| 150 this.unlisten(this._target, 'tap', 'hide'); | 150 this.unlisten(this._target, 'tap', 'hide'); |
| 151 this.unlisten(this, 'mouseenter', 'hide'); | |
| 151 } | 152 } |
| 152 }, | 153 }, |
| 153 | 154 |
| 154 show: function() { | 155 show: function() { |
| 155 // If the tooltip is already showing, there's nothing to do. | 156 // If the tooltip is already showing, there's nothing to do. |
| 156 if (this._showing) | 157 if (this._showing) |
| 157 return; | 158 return; |
| 158 | 159 |
| 159 if (Polymer.dom(this).textContent.trim() === '') | 160 if (Polymer.dom(this).textContent.trim() === '') |
| 160 return; | 161 return; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 259 } | 260 } |
| 260 | 261 |
| 261 }, | 262 }, |
| 262 | 263 |
| 263 _onAnimationFinish: function() { | 264 _onAnimationFinish: function() { |
| 264 this._animationPlaying = false; | 265 this._animationPlaying = false; |
| 265 if (!this._showing) { | 266 if (!this._showing) { |
| 266 this.toggleClass('hidden', true, this.$.tooltip); | 267 this.toggleClass('hidden', true, this.$.tooltip); |
| 267 } | 268 } |
| 268 }, | 269 }, |
| 269 }); | 270 }); |
| OLD | NEW |