| OLD | NEW |
| 1 | 1 Polymer({ |
| 2 Polymer({ | |
| 3 is: 'paper-checkbox', | 2 is: 'paper-checkbox', |
| 4 | 3 |
| 5 behaviors: [ | 4 behaviors: [ |
| 6 Polymer.PaperInkyFocusBehavior | 5 Polymer.PaperInkyFocusBehavior |
| 7 ], | 6 ], |
| 8 | 7 |
| 9 hostAttributes: { | 8 hostAttributes: { |
| 10 role: 'checkbox', | 9 role: 'checkbox', |
| 11 'aria-checked': false, | 10 'aria-checked': false, |
| 12 tabindex: 0 | 11 tabindex: 0 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 40 * If true, the button toggles the active state with each tap or press | 39 * If true, the button toggles the active state with each tap or press |
| 41 * of the spacebar. | 40 * of the spacebar. |
| 42 */ | 41 */ |
| 43 toggles: { | 42 toggles: { |
| 44 type: Boolean, | 43 type: Boolean, |
| 45 value: true, | 44 value: true, |
| 46 reflectToAttribute: true | 45 reflectToAttribute: true |
| 47 } | 46 } |
| 48 }, | 47 }, |
| 49 | 48 |
| 50 ready: function() { | 49 attached: function() { |
| 51 if (Polymer.dom(this).textContent == '') { | 50 var trimmedText = Polymer.dom(this).textContent.trim(); |
| 51 if (trimmedText === '') { |
| 52 this.$.checkboxLabel.hidden = true; | 52 this.$.checkboxLabel.hidden = true; |
| 53 } else { | 53 } |
| 54 this.setAttribute('aria-label', Polymer.dom(this).textContent); | 54 // Don't stomp over a user-set aria-label. |
| 55 if (trimmedText !== '' && !this.getAttribute('aria-label')) { |
| 56 this.setAttribute('aria-label', trimmedText); |
| 55 } | 57 } |
| 56 this._isReady = true; | 58 this._isReady = true; |
| 57 }, | 59 }, |
| 58 | 60 |
| 59 // button-behavior hook | 61 // button-behavior hook |
| 60 _buttonStateChanged: function() { | 62 _buttonStateChanged: function() { |
| 61 if (this.disabled) { | 63 if (this.disabled) { |
| 62 return; | 64 return; |
| 63 } | 65 } |
| 64 if (this._isReady) { | 66 if (this._isReady) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 78 } | 80 } |
| 79 return ''; | 81 return ''; |
| 80 }, | 82 }, |
| 81 | 83 |
| 82 _computeCheckmarkClass: function(checked) { | 84 _computeCheckmarkClass: function(checked) { |
| 83 if (!checked) { | 85 if (!checked) { |
| 84 return 'hidden'; | 86 return 'hidden'; |
| 85 } | 87 } |
| 86 return ''; | 88 return ''; |
| 87 } | 89 } |
| 88 }) | 90 }); |
| 89 | |
| OLD | NEW |