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 ...@@ -55,25 +55,25 @@ SKY MODULE - button widgets for calculator
<script> <script>
module.exports = { module.exports = {
ThreeDButtonElement: module.registerElement({ ThreeDButtonElement: module.registerElement(
tagName: 'graybutton', class extends AbstractButton {
shadow: true, static get tagName() { return 'graybutton'; }
constructor: class extends AbstractButton { static get shadow() { return true; }
constructor (module) { constructor (module) {
super(module); super(module);
this.shadowRoot.append(module.document.findId('threed-button-shadow-tree').cloneNode(true)); this.shadowRoot.append(module.document.findId('threed-button-shadow-tree').cloneNode(true));
} }
}, }
}), ),
FlatButtonElement: module.registerElement({ FlatButtonElement: module.registerElement(
tagName: 'graybutton', class extends AbstractButton {
shadow: true, static get tagName() { return 'flatbutton'; }
constructor: class extends AbstractButton { static get shadow() { return true; }
constructor (module) { constructor (module) {
super(module); super(module);
this.shadowRoot.append(module.document.findId('flat-shadow-tree').cloneNode(true)); this.shadowRoot.append(module.document.findId('flat-shadow-tree').cloneNode(true));
} }
}, }
}), ),
}; };
</script> </script>
...@@ -19,9 +19,9 @@ SKY MODULE - defines an <element> element ...@@ -19,9 +19,9 @@ SKY MODULE - defines an <element> element
--> -->
<script> <script>
module.exports.Element = sky.registerElement({ module.exports.Element = sky.registerElement(
tagName: 'element', class extends Element {
constructor: class extends Element { static get tagName() { return 'element'; }
constructor (module) { constructor (module) {
super(); super();
this.state = 'loading'; this.state = 'loading';
...@@ -58,15 +58,13 @@ SKY MODULE - defines an <element> element ...@@ -58,15 +58,13 @@ SKY MODULE - defines an <element> element
constructor.prototype = this.definedPrototype; constructor.prototype = this.definedPrototype;
else else
constructor.prototype = sky.Element; constructor.prototype = sky.Element;
this.module.exports[constructorName] = this.registerElement({ constructor.tagName = this.getAttribute('name');
tagName: this.getAttribute('name'), constructor.shadow = style || template;
shadow: style || template, this.module.exports[constructorName] = this.registerElement(constructor);
constructor: constructor,
});
delete this.definedPrototype; delete this.definedPrototype;
delete this.module; delete this.module;
this.state = 'loaded'; this.state = 'loaded';
} }
}, }
}); );
</script> </script>
...@@ -9,10 +9,10 @@ SKY MODULE - radio button and radio button group ...@@ -9,10 +9,10 @@ SKY MODULE - radio button and radio button group
</style> </style>
</template> </template>
<script> <script>
module.exports.RadioElement = module.registerElement({ module.exports.RadioElement = module.registerElement(
tagName: 'radio', class extends Element {
shadow: true, static get tagName() { return 'radio'; }
constructor: class extends Element { static get shadow() { return true; }
constructor (module) { constructor (module) {
super(module); super(module);
this.addEventListener('click', (event) => this.checked = true); this.addEventListener('click', (event) => this.checked = true);
...@@ -38,8 +38,8 @@ SKY MODULE - radio button and radio button group ...@@ -38,8 +38,8 @@ 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);
} }
}, }
}); );
</script> </script>
<!-- <radiogroup> --> <!-- <radiogroup> -->
...@@ -49,10 +49,10 @@ SKY MODULE - radio button and radio button group ...@@ -49,10 +49,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', class extends Element {
shadow: true, static get tagName() { return 'radiogroup'; }
constructor: (class extends Element { static get shadow() { return true; }
constructor (module) { constructor (module) {
super(module); super(module);
this.shadowRoot.append(module.document.findId('radiogroup-shadow').content.cloneNode(true)); this.shadowRoot.append(module.document.findId('radiogroup-shadow').content.cloneNode(true));
...@@ -81,6 +81,6 @@ SKY MODULE - radio button and radio button group ...@@ -81,6 +81,6 @@ SKY MODULE - radio button and radio button group
if (child != radio) if (child != radio)
child.checked = false; child.checked = false;
} }
}, }
}); );
</script> </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