Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

::template(true) not working with connectedCallback #9

Open
progelio opened this issue May 6, 2018 · 23 comments
Open

::template(true) not working with connectedCallback #9

progelio opened this issue May 6, 2018 · 23 comments

Comments

@progelio
Copy link

progelio commented May 6, 2018

    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>`
        }
    })
@ghost
Copy link

ghost commented May 6, 2018

@csuwildcat I just plugged this into jasmine and it's working as described by @progelio

@progelio
Copy link
Author

progelio commented May 6, 2018

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>

@ghost
Copy link

ghost commented May 6, 2018

If you have codepen I could provide a link to it with the test

@progelio
Copy link
Author

progelio commented May 6, 2018

Ok, just made a codepen account. Here it is:

https://codepen.io/progelio/pen/VxMgme

@csuwildcat
Copy link
Member

csuwildcat commented May 6, 2018 via email

@ghost
Copy link

ghost commented May 6, 2018

Got the error below.

SyntaxError: super() is only valid in derived class constructors.

@progelio
Copy link
Author

progelio commented May 6, 2018

this.render() works instead of super(). But, I think the presence of "connectedCallback" shouldn't interfere with "::template(true)"

@ghost
Copy link

ghost commented May 6, 2018

image
here is a image tof he jasmine stack trace, would you like a pr with the Jasmine @csuwildcat ?

@ghost
Copy link

ghost commented May 6, 2018

thanks @progelio.

@progelio
Copy link
Author

progelio commented May 6, 2018

Not a problem. This is actually a great project. Awesome work.

@ghost
Copy link

ghost commented May 6, 2018

Jasmine Spec list image:
image

@ghost
Copy link

ghost commented May 6, 2018

@csuwildcat could this.render() be kickstarting the behavior by initiating the promise?

@ghost
Copy link

ghost commented May 6, 2018

https://codepen.io/kipomaha/pen/XqeGNd

here is a link to a codepen I created with a codepen jasmine template
@progelio

@ghost
Copy link

ghost commented May 6, 2018

for some reason its not passing the specs like in the jasmine image above

@ghost
Copy link

ghost commented May 6, 2018

If you go to settings on the codepen you can see the dependencies by clicking the javascript tab when the settings screen pops up

@ghost
Copy link

ghost commented May 6, 2018

okay @progelio @csuwildcat
I got the pen working here => https://codepen.io/kipomaha/pen/XqeGNd [at the same pen url]

@ghost
Copy link

ghost commented May 6, 2018

you can fork if you want their is a total of three errors

@csuwildcat
Copy link
Member

I modded the original pen that had the error with the super call and it works: https://codepen.io/csuwldcat/pen/QrJrRg

@csuwildcat
Copy link
Member

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.

@ghost
Copy link

ghost commented May 18, 2018

Nice did you want that to be put on the jasmine for the docs?

@ghost
Copy link

ghost commented May 18, 2018

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

@csuwildcat
Copy link
Member

csuwildcat commented May 19, 2018 via email

@ghost
Copy link

ghost commented May 20, 2018

It's not a big deal, I stopped making PR's, because I figured you'd get to it when you got to it. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants