Specs: custom element constructor argument shouldn't clash with the module-global 'module' identifier
Review URL: https://codereview.chromium.org/829133003
This commit is contained in:
parent
f8cce94873
commit
79a529c6d9
@ -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
|
|||||||
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
|
|||||||
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
|
|||||||
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
|
|||||||
}
|
}
|
||||||
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
|
|||||||
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
|
|||||||
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 () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user