Skip to content

Commit fbeef1e

Browse files
committed
in designer template could be defined late ;-)
1 parent 35039e8 commit fbeef1e

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"description": "Base Custom Webcomponent",
33
"name": "@node-projects/base-custom-webcomponent",
4-
"version": "0.25.0",
4+
"version": "0.25.1",
55
"type": "module",
66
"main": "./dist/index.js",
77
"author": "",

src/DeclaritiveBaseCustomWebcomponent.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ class DeclaritiveBaseCustomWebcomponent extends BaseCustomWebComponentNoAttached
3333
constructor() {
3434
super();
3535
this._parseAttributesToProperties();
36-
const template = this.querySelector('template');
3736
let props = {};
3837
if (this.properties) {
3938
if (this.properties[0] === '{') {
@@ -46,7 +45,10 @@ class DeclaritiveBaseCustomWebcomponent extends BaseCustomWebComponentNoAttached
4645
}
4746
}
4847
const name = this.name;
48+
const definingElement = this;
4949
window[name] = function () {
50+
if (window[name].template === undefined)
51+
window[name].template = definingElement.querySelector('template');
5052
const instance = Reflect.construct(BaseDeclaritiveWebcomponent, [], window[name]);
5153

5254
for (let p in props) {
@@ -71,8 +73,6 @@ class DeclaritiveBaseCustomWebcomponent extends BaseCustomWebComponentNoAttached
7173
return instance;
7274
}
7375

74-
75-
window[name].template = template;
7676
//window[name].style = style;
7777
window[name].properties = props;
7878
window[name]._propertiesDictionary = null;

0 commit comments

Comments
 (0)