-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Hydrating element removes every other attribute #1733
Comments
Thought I would have a good chunk of open source time to look into this today. So far I've only had time to add a failing test. Maybe helpful to someone? |
I do believe the hydration feature is meant to be used with SSR, not an unknown element with unknown attributes. While the odd numbered attributes thing is odd (unintended), I think your situation is a case of UD. |
This still exists in Svelte 3. Here's a purer example that can be used in Sapper: {#if process.browser}
<div>
Foo
</div>
{/if}
<div attr-a attr-b attr-c attr-d attr-e>
Bar
</div> (where |
I'm guessing the bug is that in this loop we don't want to be incrementing |
fix removing attributes during hydration
Fixed (finally!) in 3.17.2. |
I'm new to Svelte so it's entirely possible i'm missing something basic. I'm seeing some weird behavior around the hydration feature. Attributes on the element being hydrated are removed and I'm not sure why.
For example, given this markup:
and this component:
the hydrated dom ends up being this:
At first glance it seems that it maybe only works with certain attributes like
class
orrole
but that's not the case. When I change the order it seems like the odd numbered attributes are being removed.given this:
we end up with this:
here's a small reproduction to play around with: https://github.com/sammynave/rehydrate-attrs
The text was updated successfully, but these errors were encountered: