| OLD | NEW |
| (Empty) |
| 1 | |
| 2 | |
| 3 Polymer('paper-radio-button', { | |
| 4 | |
| 5 /** | |
| 6 * Fired when the checked state changes due to user interaction. | |
| 7 * | |
| 8 * @event change | |
| 9 */ | |
| 10 | |
| 11 /** | |
| 12 * Fired when the checked state changes. | |
| 13 * | |
| 14 * @event core-change | |
| 15 */ | |
| 16 | |
| 17 publish: { | |
| 18 /** | |
| 19 * Gets or sets the state, `true` is checked and `false` is unchecked. | |
| 20 * | |
| 21 * @attribute checked | |
| 22 * @type boolean | |
| 23 * @default false | |
| 24 */ | |
| 25 checked: {value: false, reflect: true}, | |
| 26 | |
| 27 /** | |
| 28 * The label for the radio button. | |
| 29 * | |
| 30 * @attribute label | |
| 31 * @type string | |
| 32 * @default '' | |
| 33 */ | |
| 34 label: '', | |
| 35 | |
| 36 /** | |
| 37 * Normally the user cannot uncheck the radio button by tapping once | |
| 38 * checked. Setting this property to `true` makes the radio button | |
| 39 * toggleable from checked to unchecked. | |
| 40 * | |
| 41 * @attribute toggles | |
| 42 * @type boolean | |
| 43 * @default false | |
| 44 */ | |
| 45 toggles: false, | |
| 46 | |
| 47 /** | |
| 48 * If true, the user cannot interact with this element. | |
| 49 * | |
| 50 * @attribute disabled | |
| 51 * @type boolean | |
| 52 * @default false | |
| 53 */ | |
| 54 disabled: {value: false, reflect: true} | |
| 55 }, | |
| 56 | |
| 57 eventDelegates: { | |
| 58 tap: 'tap' | |
| 59 }, | |
| 60 | |
| 61 tap: function() { | |
| 62 if (this.disabled) { | |
| 63 return; | |
| 64 } | |
| 65 var old = this.checked; | |
| 66 this.toggle(); | |
| 67 if (this.checked !== old) { | |
| 68 this.fire('change'); | |
| 69 } | |
| 70 }, | |
| 71 | |
| 72 toggle: function() { | |
| 73 this.checked = !this.toggles || !this.checked; | |
| 74 }, | |
| 75 | |
| 76 checkedChanged: function() { | |
| 77 this.setAttribute('aria-checked', this.checked ? 'true' : 'false'); | |
| 78 this.fire('core-change'); | |
| 79 }, | |
| 80 | |
| 81 labelChanged: function() { | |
| 82 this.setAttribute('aria-label', this.label); | |
| 83 } | |
| 84 | |
| 85 }); | |
| 86 | |
| OLD | NEW |