mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Specs: define registerElement() a little differently, so that the code
that uses it looks nicer; this moves the complexity to places that register elements without using 'class' (e.g. the internals of frameworks that create elements for defining elements) Review URL: https://codereview.chromium.org/699083005
This commit is contained in:
parent
01f3d8fa67
commit
61f4494e25
@ -16,7 +16,7 @@ SKY MODULE - radio button and radio button group
|
|||||||
module.exports.RadioElement = module.registerElement({
|
module.exports.RadioElement = module.registerElement({
|
||||||
tagName: 'radio',
|
tagName: 'radio',
|
||||||
shadow: true,
|
shadow: true,
|
||||||
prototype: (class extends Element {
|
constructor: class extends Element {
|
||||||
constructor (module) {
|
constructor (module) {
|
||||||
super(module);
|
super(module);
|
||||||
this.addEventListener('click', (event) => this.checked = true);
|
this.addEventListener('click', (event) => this.checked = true);
|
||||||
@ -42,7 +42,7 @@ SKY MODULE - radio button and radio button group
|
|||||||
if (this.parentNode instanceof module.exports.RadioGroupElement)
|
if (this.parentNode instanceof module.exports.RadioGroupElement)
|
||||||
this.parentNode.setChecked(this);
|
this.parentNode.setChecked(this);
|
||||||
}
|
}
|
||||||
}).prototype,
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -53,10 +53,10 @@ SKY MODULE - radio button and radio button group
|
|||||||
</style>
|
</style>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
module.exports.RadioGroupElement = module.registerElement({
|
module.exports.RadioGroupElement = module.registerElement{
|
||||||
tagName: 'radiogroup',
|
tagName: 'radiogroup',
|
||||||
shadow: true,
|
shadow: true,
|
||||||
prototype: (class extends Element {
|
constructor: (class extends Element {
|
||||||
constructor (module) {
|
constructor (module) {
|
||||||
super(module);
|
super(module);
|
||||||
this.shadowRoot.appendChild(module.document.findId('radiogroup-shadow').content.cloneNode(true));
|
this.shadowRoot.appendChild(module.document.findId('radiogroup-shadow').content.cloneNode(true));
|
||||||
@ -85,6 +85,6 @@ SKY MODULE - radio button and radio button group
|
|||||||
if (child != radio)
|
if (child != radio)
|
||||||
child.checked = false;
|
child.checked = false;
|
||||||
}
|
}
|
||||||
}).prototype,
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user