Skip to content
Discussion options

You must be logged in to vote

The problem you're hitting in your current implementation is that the slot you're checking with this._headingNodes.length never exists, so the count of slotted children will always be 0 (because the queryAssignedNodes decorator defaults to 0 if the slot doesn't exist). The slot doesn't exist on first render because no child DOM exists yet on first render. And actually even if something triggered a subsequent render, the count will still always be 0, because only the default slot could have been rendered, and never the heading slot you're looking for.

Here's a playground which includes a heading slot even in the first case, because otherwise there is no way to check if anything was slotted…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@alexgagnon
Comment options

Answer selected by alexgagnon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants