Skip to content

Add <svelte:html> special element #8663

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

Open
KKKaisar opened this issue May 30, 2023 · 4 comments · May be fixed by #14397
Open

Add <svelte:html> special element #8663

KKKaisar opened this issue May 30, 2023 · 4 comments · May be fixed by #14397
Assignees

Comments

@KKKaisar
Copy link

Describe the problem

I need to change tag's attributes dynamically.

Describe the proposed solution

Only I can do is document.querySelector('html').setAttribute('data-theme','dark') and document.querySelector('html').setAttribute('lang','kz') for every attribute

Alternatives considered

Please add svelte:html special element for that

Importance

would make my life easier

@srikantgudi
Copy link

That would be a good addition, I guess.

@LorisSigrist
Copy link

+1 on this suggestion
This would come in handy when doing i18n work and you need to set the lang attribute on the <html> element

@LeaVerou
Copy link

LeaVerou commented Mar 4, 2024

Came here to suggest this too. My use case was setting the CSS color-scheme property on <html> to switch between light/dark mode. Setting CSS variables on <html> is also a pretty common use case.

@xwirkijowski
Copy link

This would be a perfect quick solution to conditionally add microdata to the html tag, like itemscope itemtype="https://schema.org/FAQPage".

But I guess it's better to do it by directly accessing it with js to avoid overhead.

@paoloricciuti paoloricciuti self-assigned this Nov 15, 2024
dummdidumm added a commit that referenced this issue Nov 19, 2024
@dummdidumm dummdidumm linked a pull request Nov 21, 2024 that will close this issue
6 tasks
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

Successfully merging a pull request may close this issue.

7 participants