Commit 9d70f573 authored by Hixie's avatar Hixie

Specs: registerElement(registerElement(...)) failed to work as expected

Review URL: https://codereview.chromium.org/836153005
parent 00f2a537
......@@ -55,25 +55,25 @@ SKY MODULE - button widgets for calculator
<script>
module.exports = {
ThreeDButtonElement: module.registerElement({
tagName: 'graybutton',
shadow: true,
constructor: class extends AbstractButton {
ThreeDButtonElement: module.registerElement(
class extends AbstractButton {
static get tagName() { return 'graybutton'; }
static get shadow() { return true; }
constructor (module) {
super(module);
this.shadowRoot.append(module.document.findId('threed-button-shadow-tree').cloneNode(true));
}
},
}),
FlatButtonElement: module.registerElement({
tagName: 'graybutton',
shadow: true,
constructor: class extends AbstractButton {
}
),
FlatButtonElement: module.registerElement(
class extends AbstractButton {
static get tagName() { return 'flatbutton'; }
static get shadow() { return true; }
constructor (module) {
super(module);
this.shadowRoot.append(module.document.findId('flat-shadow-tree').cloneNode(true));
}
},
}),
}
),
};
</script>
......@@ -19,9 +19,9 @@ SKY MODULE - defines an <element> element
-->
<script>
module.exports.Element = sky.registerElement({
tagName: 'element',
constructor: class extends Element {
module.exports.Element = sky.registerElement(
class extends Element {
static get tagName() { return 'element'; }
constructor (module) {
super();
this.state = 'loading';
......@@ -58,15 +58,13 @@ SKY MODULE - defines an <element> element
constructor.prototype = this.definedPrototype;
else
constructor.prototype = sky.Element;
this.module.exports[constructorName] = this.registerElement({
tagName: this.getAttribute('name'),
shadow: style || template,
constructor: constructor,
});
constructor.tagName = this.getAttribute('name');
constructor.shadow = style || template;
this.module.exports[constructorName] = this.registerElement(constructor);
delete this.definedPrototype;
delete this.module;
this.state = 'loaded';
}
},
});
}
);
</script>
......@@ -9,10 +9,10 @@ SKY MODULE - radio button and radio button group
</style>
</template>
<script>
module.exports.RadioElement = module.registerElement({
tagName: 'radio',
shadow: true,
constructor: class extends Element {
module.exports.RadioElement = module.registerElement(
class extends Element {
static get tagName() { return 'radio'; }
static get shadow() { return true; }
constructor (module) {
super(module);
this.addEventListener('click', (event) => this.checked = true);
......@@ -38,8 +38,8 @@ SKY MODULE - radio button and radio button group
if (this.parentNode instanceof module.exports.RadioGroupElement)
this.parentNode.setChecked(this);
}
},
});
}
);
</script>
<!-- <radiogroup> -->
......@@ -49,10 +49,10 @@ SKY MODULE - radio button and radio button group
</style>
</template>
<script>
module.exports.RadioGroupElement = module.registerElement{
tagName: 'radiogroup',
shadow: true,
constructor: (class extends Element {
module.exports.RadioGroupElement = module.registerElement(
class extends Element {
static get tagName() { return 'radiogroup'; }
static get shadow() { return true; }
constructor (module) {
super(module);
this.shadowRoot.append(module.document.findId('radiogroup-shadow').content.cloneNode(true));
......@@ -81,6 +81,6 @@ SKY MODULE - radio button and radio button group
if (child != radio)
child.checked = false;
}
},
});
}
);
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment