::template(true) not working with connectedCallback
progelio opened this issue · 23 comments
xtag.create('x-test', class extends XTagElement {
connectedCallback() { } //if I remove this, then it renders.
name() { return "My Test Tag" }
"::template(true)" () {
return `<h2>I am ${this.name()}</h2>`
}
})
@csuwildcat I just plugged this into jasmine and it's working as described by @progelio
I don't know what jasmine is. I will find out. Try this:
<title></title> <script src="x-tag-polyfilled.js"></script><script>
xtag.create('x-test', class extends XTagElement {
connectedCallback() { } //if I remove this, then it renders.
name() { return "My Test Tag" }
"::template(true)" () {
return `<h2>I am ${this.name()}</h2>`
}
});
</script>
If you have codepen I could provide a link to it with the test
Ok, just made a codepen account. Here it is:
Got the error below.
SyntaxError: super() is only valid in derived class constructors.
this.render() works instead of super(). But, I think the presence of "connectedCallback" shouldn't interfere with "::template(true)"
here is a image tof he jasmine stack trace, would you like a pr with the Jasmine @csuwildcat ?
thanks @progelio.
Not a problem. This is actually a great project. Awesome work.
@csuwildcat could this.render()
be kickstarting the behavior by initiating the promise?
https://codepen.io/kipomaha/pen/XqeGNd
here is a link to a codepen I created with a codepen jasmine template
@progelio
for some reason its not passing the specs like in the jasmine image above
If you go to settings on the codepen you can see the dependencies by clicking the javascript tab when the settings screen pops up
okay @progelio @csuwildcat
I got the pen working here => https://codepen.io/kipomaha/pen/XqeGNd [at the same pen url]
you can fork if you want their is a total of three errors
I modded the original pen that had the error with the super call and it works: https://codepen.io/csuwldcat/pen/QrJrRg
If you override a function, you must call super.FN_NAME(), so that the previous version of the function in the prototype chain is also called.
Nice did you want that to be put on the jasmine for the docs?
lol...I just looked in to super more I forgot you can use it like that duh...super.funct()
....probably good that I don't use it much. Thanks for the information
It's not a big deal, I stopped making PR's, because I figured you'd get to it when you got to it.