| OLD | NEW |
| 1 (function() { | 1 (function() { |
| 2 'use strict'; | 2 'use strict'; |
| 3 | 3 |
| 4 Polymer({ | 4 Polymer({ |
| 5 is: 'iron-dropdown', | 5 is: 'iron-dropdown', |
| 6 | 6 |
| 7 behaviors: [ | 7 behaviors: [ |
| 8 Polymer.IronControlState, | 8 Polymer.IronControlState, |
| 9 Polymer.IronA11yKeysBehavior, | 9 Polymer.IronA11yKeysBehavior, |
| 10 Polymer.IronOverlayBehavior, | 10 Polymer.IronOverlayBehavior, |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 }, | 115 }, |
| 116 | 116 |
| 117 ready: function() { | 117 ready: function() { |
| 118 // Memoized scrolling position, used to block scrolling outside. | 118 // Memoized scrolling position, used to block scrolling outside. |
| 119 this._scrollTop = 0; | 119 this._scrollTop = 0; |
| 120 this._scrollLeft = 0; | 120 this._scrollLeft = 0; |
| 121 // Used to perform a non-blocking refit on scroll. | 121 // Used to perform a non-blocking refit on scroll. |
| 122 this._refitOnScrollRAF = null; | 122 this._refitOnScrollRAF = null; |
| 123 }, | 123 }, |
| 124 | 124 |
| 125 attached: function () { |
| 126 if (!this.sizingTarget || this.sizingTarget === this) { |
| 127 this.sizingTarget = this.containedElement; |
| 128 } |
| 129 }, |
| 130 |
| 125 detached: function() { | 131 detached: function() { |
| 126 this.cancelAnimation(); | 132 this.cancelAnimation(); |
| 133 document.removeEventListener('scroll', this._boundOnCaptureScroll); |
| 127 Polymer.IronDropdownScrollManager.removeScrollLock(this); | 134 Polymer.IronDropdownScrollManager.removeScrollLock(this); |
| 128 }, | 135 }, |
| 129 | 136 |
| 130 /** | 137 /** |
| 131 * Called when the value of `opened` changes. | 138 * Called when the value of `opened` changes. |
| 132 * Overridden from `IronOverlayBehavior` | 139 * Overridden from `IronOverlayBehavior` |
| 133 */ | 140 */ |
| 134 _openedChanged: function() { | 141 _openedChanged: function() { |
| 135 if (this.opened && this.disabled) { | 142 if (this.opened && this.disabled) { |
| 136 this.cancel(); | 143 this.cancel(); |
| 137 } else { | 144 } else { |
| 138 this.cancelAnimation(); | 145 this.cancelAnimation(); |
| 139 this.sizingTarget = this.containedElement || this.sizingTarget; | |
| 140 this._updateAnimationConfig(); | 146 this._updateAnimationConfig(); |
| 141 this._saveScrollPosition(); | 147 this._saveScrollPosition(); |
| 142 if (this.opened) { | 148 if (this.opened) { |
| 143 document.addEventListener('scroll', this._boundOnCaptureScroll); | 149 document.addEventListener('scroll', this._boundOnCaptureScroll); |
| 144 !this.allowOutsideScroll && Polymer.IronDropdownScrollManager.push
ScrollLock(this); | 150 !this.allowOutsideScroll && Polymer.IronDropdownScrollManager.push
ScrollLock(this); |
| 145 } else { | 151 } else { |
| 146 document.removeEventListener('scroll', this._boundOnCaptureScroll)
; | 152 document.removeEventListener('scroll', this._boundOnCaptureScroll)
; |
| 147 Polymer.IronDropdownScrollManager.removeScrollLock(this); | 153 Polymer.IronDropdownScrollManager.removeScrollLock(this); |
| 148 } | 154 } |
| 149 Polymer.IronOverlayBehaviorImpl._openedChanged.apply(this, arguments
); | 155 Polymer.IronOverlayBehaviorImpl._openedChanged.apply(this, arguments
); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 _applyFocus: function () { | 269 _applyFocus: function () { |
| 264 var focusTarget = this.focusTarget || this.containedElement; | 270 var focusTarget = this.focusTarget || this.containedElement; |
| 265 if (focusTarget && this.opened && !this.noAutoFocus) { | 271 if (focusTarget && this.opened && !this.noAutoFocus) { |
| 266 focusTarget.focus(); | 272 focusTarget.focus(); |
| 267 } else { | 273 } else { |
| 268 Polymer.IronOverlayBehaviorImpl._applyFocus.apply(this, arguments); | 274 Polymer.IronOverlayBehaviorImpl._applyFocus.apply(this, arguments); |
| 269 } | 275 } |
| 270 } | 276 } |
| 271 }); | 277 }); |
| 272 })(); | 278 })(); |
| OLD | NEW |