Specs: define registerElement() more carefully; add an 'end tag
parsed' callback; pass the element's module to the constructor when constructing a custom element (these are rather experimental changes and we may want to go a different way on this stuff) Review URL: https://codereview.chromium.org/701873004
This commit is contained in:
@@ -28,9 +28,12 @@ to create custom elements. The following elements are built into the engine:
|
||||
- ``content``: Visually projects descendents of the shadow host
|
||||
- ``shadow``: Visually projects older shadow roots of the shadow host
|
||||
- ``img``: Displays an image
|
||||
- ``div``: Neutral element for hooking styles in shadow trees
|
||||
- ``span``: Neutral element for hooking styles in shadow trees
|
||||
- ``a``: Links to another Mojo application
|
||||
- ``title``: Briefly describes the current application state to the user
|
||||
- ``t``: Preserve whitespace (by default, whitespace nodes are dropped)
|
||||
- ``error``: Represents a parse error
|
||||
|
||||
### Additional Elements ###
|
||||
|
||||
|
||||
@@ -16,9 +16,9 @@ SKY MODULE - radio button and radio button group
|
||||
module.exports.RadioElement = module.registerElement({
|
||||
tagName: 'radio',
|
||||
shadow: true,
|
||||
prototype: class extends Element {
|
||||
constructor () {
|
||||
super();
|
||||
prototype: (class extends Element {
|
||||
constructor (module) {
|
||||
super(module);
|
||||
this.addEventListener('click', (event) => this.checked = true);
|
||||
this.shadowRoot.appendChild(module.document.findId('radio-shadow').content.cloneNode(true));
|
||||
}
|
||||
@@ -42,7 +42,7 @@ SKY MODULE - radio button and radio button group
|
||||
if (this.parentNode instanceof module.exports.RadioGroupElement)
|
||||
this.parentNode.setChecked(this);
|
||||
}
|
||||
},
|
||||
}).prototype,
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -56,9 +56,9 @@ SKY MODULE - radio button and radio button group
|
||||
module.exports.RadioGroupElement = module.registerElement({
|
||||
tagName: 'radiogroup',
|
||||
shadow: true,
|
||||
prototype: class extends Element {
|
||||
constructor () {
|
||||
super();
|
||||
prototype: (class extends Element {
|
||||
constructor (module) {
|
||||
super(module);
|
||||
this.shadowRoot.appendChild(module.document.findId('radiogroup-shadow').content.cloneNode(true));
|
||||
}
|
||||
get value () {
|
||||
@@ -85,6 +85,6 @@ SKY MODULE - radio button and radio button group
|
||||
if (child != radio)
|
||||
child.checked = false;
|
||||
}
|
||||
},
|
||||
}).prototype,
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user