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.content has unusable value #10330

Closed
dSalieri opened this issue May 8, 2024 · 1 comment
Closed

template.content has unusable value #10330

dSalieri opened this issue May 8, 2024 · 1 comment

Comments

@dSalieri
Copy link

dSalieri commented May 8, 2024

What is the issue with the HTML Standard?

The spec has 2 contradictory places.

This one:

and the second one:

If you point on the stage of HTML Parser, so there impossible to get template element for extracting null value.

For example, I have the next code:

<!doctype html>
<html>
 <head>
  <meta charset="UTF-8" />
  <title>Hello World!</title>
 </head>
 <body>
  <host-element>
   <template shadowrootmode="open">
    <script>debugger</script>
    <style>shadow styles</style>
    <h2>Shadow Content</h2>
    <slot></slot>
   </template>
   <h2>Light content</h2>
  </host-element>
 </body>
</html>

Browser (I mean the last chrome) will pause the parsing at <script> due with debugger instruction. Look at the DOM in current state:

That is, the parser has not yet finished analyzing the contents of the template node, but instead of template we already have a shadow-root node. This way we can never get template.content equal to null.

So .content getter of a template never can return null, please fix the spec or show me a counterexample if I'm wrong.

@annevk
Copy link
Member

annevk commented May 8, 2024

Please don't file duplicates. It can return null when you use declarative shadow roots because then template contents is a ShadowRoot node. #10322

@annevk annevk closed this as not planned Won't fix, can't repro, duplicate, stale May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants