| OLD | NEW | 
|---|
| 1 Polymer({ | 1 Polymer({ | 
| 2       is: 'paper-toggle-button', | 2       is: 'paper-toggle-button', | 
| 3 | 3 | 
| 4       behaviors: [ | 4       behaviors: [ | 
| 5         Polymer.PaperInkyFocusBehavior | 5         Polymer.PaperInkyFocusBehavior, | 
|  | 6         Polymer.IronCheckedElementBehavior | 
| 6       ], | 7       ], | 
| 7 | 8 | 
| 8       hostAttributes: { | 9       hostAttributes: { | 
| 9         role: 'button', | 10         role: 'button', | 
| 10         'aria-pressed': 'false', | 11         'aria-pressed': 'false', | 
| 11         tabindex: 0 | 12         tabindex: 0 | 
| 12       }, | 13       }, | 
| 13 | 14 | 
| 14       properties: { | 15       properties: { | 
| 15         /** | 16         /** | 
| 16          * Fired when the checked state changes due to user interaction. | 17          * Fired when the checked state changes due to user interaction. | 
| 17          * | 18          * | 
| 18          * @event change | 19          * @event change | 
| 19          */ | 20          */ | 
| 20         /** | 21         /** | 
| 21          * Fired when the checked state changes. | 22          * Fired when the checked state changes. | 
| 22          * | 23          * | 
| 23          * @event iron-change | 24          * @event iron-change | 
| 24          */ | 25          */ | 
| 25         /** |  | 
| 26          * Gets or sets the state, `true` is checked and `false` is unchecked. |  | 
| 27          * |  | 
| 28          * @attribute checked |  | 
| 29          * @type boolean |  | 
| 30          * @default false |  | 
| 31          */ |  | 
| 32         checked: { |  | 
| 33           type: Boolean, |  | 
| 34           value: false, |  | 
| 35           reflectToAttribute: true, |  | 
| 36           notify: true, |  | 
| 37           observer: '_checkedChanged' |  | 
| 38         }, |  | 
| 39 |  | 
| 40         /** |  | 
| 41          * If true, the button toggles the active state with each tap or press |  | 
| 42          * of the spacebar. |  | 
| 43          * |  | 
| 44          * @attribute toggles |  | 
| 45          * @type boolean |  | 
| 46          * @default true |  | 
| 47          */ |  | 
| 48         toggles: { |  | 
| 49           type: Boolean, |  | 
| 50           value: true, |  | 
| 51           reflectToAttribute: true |  | 
| 52         } |  | 
| 53       }, | 26       }, | 
| 54 | 27 | 
| 55       listeners: { | 28       listeners: { | 
| 56         track: '_ontrack' | 29         track: '_ontrack' | 
| 57       }, | 30       }, | 
| 58 | 31 | 
| 59       ready: function() { | 32       ready: function() { | 
| 60         this._isReady = true; | 33         this._isReady = true; | 
| 61       }, | 34       }, | 
| 62 | 35 | 
| 63       // button-behavior hook | 36       // button-behavior hook | 
| 64       _buttonStateChanged: function() { | 37       _buttonStateChanged: function() { | 
| 65         if (this.disabled) { | 38         if (this.disabled) { | 
| 66           return; | 39           return; | 
| 67         } | 40         } | 
| 68         if (this._isReady) { | 41         if (this._isReady) { | 
| 69           this.checked = this.active; | 42           this.checked = this.active; | 
| 70         } | 43         } | 
| 71       }, | 44       }, | 
| 72 | 45 | 
| 73       _checkedChanged: function(checked) { |  | 
| 74         this.active = this.checked; |  | 
| 75         this.fire('iron-change'); |  | 
| 76       }, |  | 
| 77 |  | 
| 78       _ontrack: function(event) { | 46       _ontrack: function(event) { | 
| 79         var track = event.detail; | 47         var track = event.detail; | 
| 80         if (track.state === 'start') { | 48         if (track.state === 'start') { | 
| 81           this._trackStart(track); | 49           this._trackStart(track); | 
| 82         } else if (track.state === 'track') { | 50         } else if (track.state === 'track') { | 
| 83           this._trackMove(track); | 51           this._trackMove(track); | 
| 84         } else if (track.state === 'end') { | 52         } else if (track.state === 'end') { | 
| 85           this._trackEnd(track); | 53           this._trackEnd(track); | 
| 86         } | 54         } | 
| 87       }, | 55       }, | 
| (...skipping 15 matching lines...) Expand all  Loading... | 
| 103         this.translate3d(this._x + 'px', 0, 0, this.$.toggleButton); | 71         this.translate3d(this._x + 'px', 0, 0, this.$.toggleButton); | 
| 104         this._userActivate(this._x > (this._width / 2)); | 72         this._userActivate(this._x > (this._width / 2)); | 
| 105       }, | 73       }, | 
| 106 | 74 | 
| 107       _trackEnd: function(track) { | 75       _trackEnd: function(track) { | 
| 108         this.$.toggleButton.classList.remove('dragging'); | 76         this.$.toggleButton.classList.remove('dragging'); | 
| 109         this.transform('', this.$.toggleButton); | 77         this.transform('', this.$.toggleButton); | 
| 110       } | 78       } | 
| 111 | 79 | 
| 112     }); | 80     }); | 
| OLD | NEW | 
|---|