| OLD | NEW |
| 1 SKY MODULE - radio button and radio button group | 1 SKY MODULE - radio button and radio button group |
| 2 <!-- accessibility handling not implemented yet, pending mojo service --> | 2 <!-- accessibility handling not implemented yet, pending mojo service --> |
| 3 <import src="sky:core" as="sky"/> | 3 <import src="sky:core" as="sky"/> |
| 4 | 4 |
| 5 <!-- <radio> --> | 5 <!-- <radio> --> |
| 6 <template id="radio-shadow"> | 6 <template id="radio-shadow"> |
| 7 <style> | 7 <style> |
| 8 :host { width: 1em; height: 1em; border: solid; background: white; } | 8 :host { width: 1em; height: 1em; border: solid; background: white; } |
| 9 :host[checked] { background: black; } | 9 :host[checked] { background: black; } |
| 10 </style> | 10 </style> |
| 11 </template> | 11 </template> |
| 12 <script> | 12 <script> |
| 13 module.exports = {}; | 13 module.exports = {}; |
| 14 module.exports.RadioElement = sky.registerElement('radio', class extends Elemen
t { | 14 module.exports.RadioElement = sky.registerElement('radio', class extends Elemen
t { |
| 15 constructor () { | 15 constructor () { |
| 16 this.addEventListener('click', (event) => this.checked = true); | 16 this.addEventListener('click', (event) => this.checked = true); |
| 17 this.createShadowTree().appendChild(module.document.findId('radio-shadow').
cloneNode(true)); | 17 this.createShadowTree().appendChild(module.document.findId('radio-shadow').
content.cloneNode(true)); |
| 18 } | 18 } |
| 19 get checked () { | 19 get checked () { |
| 20 return this.hasAttribute('checked'); | 20 return this.hasAttribute('checked'); |
| 21 } | 21 } |
| 22 set checked (value) { | 22 set checked (value) { |
| 23 if (value) | 23 if (value) |
| 24 this.setAttribute('checked', ''); | 24 this.setAttribute('checked', ''); |
| 25 else | 25 else |
| 26 this.removeAttribute('checked'); | 26 this.removeAttribute('checked'); |
| 27 } | 27 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 if (!((radio instanceof module.exports.Radio) && radio.parentNode == this)) | 69 if (!((radio instanceof module.exports.Radio) && radio.parentNode == this)) |
| 70 throw; | 70 throw; |
| 71 let children = this.getChildNodes(); | 71 let children = this.getChildNodes(); |
| 72 for (let child of children) | 72 for (let child of children) |
| 73 if (child instanceof module.exports.RadioElement) | 73 if (child instanceof module.exports.RadioElement) |
| 74 if (child != radio) | 74 if (child != radio) |
| 75 child.checked = false; | 75 child.checked = false; |
| 76 } | 76 } |
| 77 }); | 77 }); |
| 78 </script> | 78 </script> |
| OLD | NEW |