| OLD | NEW |
| 1 SKY MODULE - button widgets for calculator | 1 SKY MODULE - button widgets for calculator |
| 2 <!-- TODO(ianh): implement accessibility handling once the ax service exists --> | 2 <!-- TODO(ianh): implement accessibility handling once the ax service exists --> |
| 3 | 3 |
| 4 <script> | 4 <script> |
| 5 class AbstractButton extends Element { | 5 class AbstractButton extends Element { |
| 6 constructor (module) { | 6 constructor (module) { |
| 7 super(module); | 7 super(module); |
| 8 let selector = new SelectorQuery('.dynamic'); | 8 let selector = new SelectorQuery('.dynamic'); |
| 9 this.addEventListener('pointer-down', (event) => { | 9 this.addEventListener('pointer-down', (event) => { |
| 10 selector.findAll(this.shadowRoot).every((element) => element.setAttribut
e('clicked')); | 10 selector.findAll(this.shadowRoot).every((element) => element.setAttribut
e('clicked')); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 div { background: green; color: yellow; } | 48 div { background: green; color: yellow; } |
| 49 div[clicked] { background: yellow; color: green; } | 49 div[clicked] { background: yellow; color: green; } |
| 50 </style> | 50 </style> |
| 51 <div class=dynamic> | 51 <div class=dynamic> |
| 52 <content/> | 52 <content/> |
| 53 </div> | 53 </div> |
| 54 </template> | 54 </template> |
| 55 | 55 |
| 56 <script> | 56 <script> |
| 57 module.exports = { | 57 module.exports = { |
| 58 ThreeDButtonElement: module.registerElement({ | 58 ThreeDButtonElement: module.registerElement( |
| 59 tagName: 'graybutton', | 59 class extends AbstractButton { |
| 60 shadow: true, | 60 static get tagName() { return 'graybutton'; } |
| 61 constructor: class extends AbstractButton { | 61 static get shadow() { return true; } |
| 62 constructor (module) { | 62 constructor (module) { |
| 63 super(module); | 63 super(module); |
| 64 this.shadowRoot.append(module.document.findId('threed-button-shadow-tre
e').cloneNode(true)); | 64 this.shadowRoot.append(module.document.findId('threed-button-shadow-tre
e').cloneNode(true)); |
| 65 } | 65 } |
| 66 }, | 66 } |
| 67 }), | 67 ), |
| 68 FlatButtonElement: module.registerElement({ | 68 FlatButtonElement: module.registerElement( |
| 69 tagName: 'graybutton', | 69 class extends AbstractButton { |
| 70 shadow: true, | 70 static get tagName() { return 'flatbutton'; } |
| 71 constructor: class extends AbstractButton { | 71 static get shadow() { return true; } |
| 72 constructor (module) { | 72 constructor (module) { |
| 73 super(module); | 73 super(module); |
| 74 this.shadowRoot.append(module.document.findId('flat-shadow-tree').clone
Node(true)); | 74 this.shadowRoot.append(module.document.findId('flat-shadow-tree').clone
Node(true)); |
| 75 } | 75 } |
| 76 }, | 76 } |
| 77 }), | 77 ), |
| 78 }; | 78 }; |
| 79 </script> | 79 </script> |
| OLD | NEW |