Commit 79a529c6 authored by Hixie's avatar Hixie

Specs: custom element constructor argument shouldn't clash with the...

Specs: custom element constructor argument shouldn't clash with the module-global 'module' identifier

Review URL: https://codereview.chromium.org/829133003
parent f8cce948
...@@ -3,8 +3,8 @@ SKY MODULE - button widgets for calculator ...@@ -3,8 +3,8 @@ SKY MODULE - button widgets for calculator
<script> <script>
class AbstractButton extends Element { class AbstractButton extends Element {
constructor (module) { constructor (hostModule) {
super(module); super(hostModule);
let selector = new SelectorQuery('.dynamic'); let selector = new SelectorQuery('.dynamic');
this.addEventListener('pointer-down', (event) => { this.addEventListener('pointer-down', (event) => {
selector.findAll(this.shadowRoot).every((element) => element.setAttribute('clicked')); selector.findAll(this.shadowRoot).every((element) => element.setAttribute('clicked'));
...@@ -59,8 +59,8 @@ SKY MODULE - button widgets for calculator ...@@ -59,8 +59,8 @@ SKY MODULE - button widgets for calculator
class extends AbstractButton { class extends AbstractButton {
static get tagName() { return 'graybutton'; } static get tagName() { return 'graybutton'; }
static get shadow() { return true; } static get shadow() { return true; }
constructor (module) { constructor (hostModule) {
super(module); super(hostModule);
this.shadowRoot.append(module.document.findId('threed-button-shadow-tree').cloneNode(true)); this.shadowRoot.append(module.document.findId('threed-button-shadow-tree').cloneNode(true));
} }
} }
...@@ -69,8 +69,8 @@ SKY MODULE - button widgets for calculator ...@@ -69,8 +69,8 @@ SKY MODULE - button widgets for calculator
class extends AbstractButton { class extends AbstractButton {
static get tagName() { return 'flatbutton'; } static get tagName() { return 'flatbutton'; }
static get shadow() { return true; } static get shadow() { return true; }
constructor (module) { constructor (hostModule) {
super(module); super(hostModule);
this.shadowRoot.append(module.document.findId('flat-shadow-tree').cloneNode(true)); this.shadowRoot.append(module.document.findId('flat-shadow-tree').cloneNode(true));
} }
} }
......
...@@ -22,10 +22,10 @@ SKY MODULE - defines an <element> element ...@@ -22,10 +22,10 @@ SKY MODULE - defines an <element> element
module.exports.Element = sky.registerElement( module.exports.Element = sky.registerElement(
class extends Element { class extends Element {
static get tagName() { return 'element'; } static get tagName() { return 'element'; }
constructor (module) { constructor (hostModule) {
super(); super(hostModule);
this.state = 'loading'; this.state = 'loading';
this.module = module; this.module = hostModule;
this.definedPrototype = sky.Element; this.definedPrototype = sky.Element;
} }
setPrototype(prototype) { setPrototype(prototype) {
...@@ -44,8 +44,8 @@ SKY MODULE - defines an <element> element ...@@ -44,8 +44,8 @@ SKY MODULE - defines an <element> element
} }
let tagName = this.getAttribute('name'); let tagName = this.getAttribute('name');
let constructorName = tagName.charAt(0).toUpperCase() + tagName.slice(1) + 'Element'; let constructorName = tagName.charAt(0).toUpperCase() + tagName.slice(1) + 'Element';
let constructor = function (module) { let constructor = function (hostModule) {
super(module); super(hostModule);
if (this.init) if (this.init)
this.init(); this.init();
if (style) if (style)
......
...@@ -13,8 +13,8 @@ SKY MODULE - radio button and radio button group ...@@ -13,8 +13,8 @@ SKY MODULE - radio button and radio button group
class extends Element { class extends Element {
static get tagName() { return 'radio'; } static get tagName() { return 'radio'; }
static get shadow() { return true; } static get shadow() { return true; }
constructor (module) { constructor (hostModule) {
super(module); super(hostModule);
this.addEventListener('click', (event) => this.checked = true); this.addEventListener('click', (event) => this.checked = true);
this.shadowRoot.append(module.document.findId('radio-shadow').content.cloneNode(true)); this.shadowRoot.append(module.document.findId('radio-shadow').content.cloneNode(true));
} }
...@@ -53,8 +53,8 @@ SKY MODULE - radio button and radio button group ...@@ -53,8 +53,8 @@ SKY MODULE - radio button and radio button group
class extends Element { class extends Element {
static get tagName() { return 'radiogroup'; } static get tagName() { return 'radiogroup'; }
static get shadow() { return true; } static get shadow() { return true; }
constructor (module) { constructor (hostModule) {
super(module); super(hostModule);
this.shadowRoot.append(module.document.findId('radiogroup-shadow').content.cloneNode(true)); this.shadowRoot.append(module.document.findId('radiogroup-shadow').content.cloneNode(true));
} }
get value () { get value () {
......
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