-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
fix: add logic to select and claim raw html tags in head #6977
Conversation
fea212e
to
8dea38c
Compare
Ok, I'm assuming the PR needs more validation, since 2 weeks have passed and it's still unmerged. Therefore I'll write a test and include it in this PR. |
5029de6
to
c221c59
Compare
if (start_index === end_index) { | ||
elements.splice(cursor, elements.length - cursor); | ||
break; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happends if you have multiple {@html 'xxx'}
in the head?
how woudl you ensure you are not claiming the html tag of other components?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and yes, please include a test case for this.
I had some trouble writing tests that pass when checking for tags in head. Could you perhaps point me to some documentation? I couldn't find any do far. |
You're right, this should no longer be needed - closing, thank you. |
This PR fixes #6463 with duplicated tags in head (and possibly #6832). Thanks to the helpful investigations from @hbirler #6463 (comment) and from @rmunn #6832 (comment), the problem had to do with the selector logic for claimable elements inside head, that only selected tags with
svelte-data
prop. I came up with a solution that extended it further to include raw html tags that are between HTML_TAG_START and HTML_TAG_END comments.Note that for this logic I've added an internal api method called
get_hydratable_raw_elements
:Before submitting the PR, please make sure you do the following
[feat]
,[fix]
,[chore]
, or[docs]
.Tests
npm test
and lint the project withnpm run lint