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

HTML in Template Tag is Deleted from outerHTML #18

Closed
jon49 opened this issue Oct 24, 2020 · 9 comments
Closed

HTML in Template Tag is Deleted from outerHTML #18

jon49 opened this issue Oct 24, 2020 · 9 comments

Comments

@jon49
Copy link

jon49 commented Oct 24, 2020

When output the outerHTML of a template tag it deletes the internal html.

import { DOMParser, Element } from "https://deno.land/x/deno_dom/deno-dom-wasm.ts";

const html = `
<body>
   <template id="error-message-template">
      <snack-bar class=show><p slot="message"></p></snack-bar>
   </template>
</body>
`

const doc = new DOMParser().parseFromString(html, "text/html")!;

console.log(doc.documentElement?.outerHTML)

Really cool project. Can't wait until it gets out of alpha!

Output:

<html><head></head><body>
   <template id="error-message-template"></template>

</body></html>

In the browser it does this:

console.log(document.body.outerHTML)
<body>
   <template id="error-message-template">
      <snack-bar class="show"><p slot="message"></p></snack-bar>
   </template>

</body>
@b-fuze
Copy link
Owner

b-fuze commented Oct 24, 2020

I can fix this, but I was also planning on implementing DocumentFragment before I fixed <template> elements' behaviour to match the browser. So right now DocumentFragment is a blocker for proper function of <template>.

@jon49
Copy link
Author

jon49 commented Oct 24, 2020

No worries, it's still alpha and I'm not pitching in. So, whatever the time table you have is completely fine! I was just playing around with it to experiment with it and see if I could use it to create a quick and dirty HTML DSL. It's not quite ready yet and I should probably be using a parser combinator anyways. I just have a hard time understanding parser combinators, so I guess it is a good excuse to learn!

Thanks for your work on this library/tool!

@fxrysh
Copy link

fxrysh commented Mar 3, 2022

Any update(s) on this? Is this issue abandoned?

@b-fuze
Copy link
Owner

b-fuze commented Mar 3, 2022

No, it was just pretty slow. I'm working on an implementation for it that should land in a few weeks.

@oscarotero
Copy link
Contributor

DocumentFragment is implemented in the latest version. Should this issue be closed or there's any work to do here yet?

@b-fuze
Copy link
Owner

b-fuze commented Apr 15, 2022

This still isn't fixed. I'm getting around to it though

@pblzd
Copy link

pblzd commented May 5, 2022

Is there any way to get hands on the contained elements, meanwhile? childNodes appears to be empty no matter what I'm trying.

In any case: thank you for building this! Highly appreciated!

@sebastienfilion
Copy link

Thank you for the hard work. I would really appreciate this getting fixed soon. Can I do something to help?

@b-fuze b-fuze closed this as completed in 05369e4 May 8, 2022
@b-fuze
Copy link
Owner

b-fuze commented May 8, 2022

It should work now, if there are any further issues lmk. Thanks

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

6 participants