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

[chore] rename data-svelte to data-sveltekit #4641

Merged
merged 2 commits into from Apr 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tiny-hounds-glow.md
@@ -0,0 +1,5 @@
---
"@sveltejs/kit": patch
---

rename `data-svelte` attribute to `data-sveltekit`
2 changes: 1 addition & 1 deletion packages/kit/src/runtime/client/client.js
Expand Up @@ -341,7 +341,7 @@ export function create_client({ target, session, base, trailing_slash }) {
function initialize(result) {
current = result.state;

const style = document.querySelector('style[data-svelte]');
const style = document.querySelector('style[data-sveltekit]');
if (style) style.remove();

page = result.props.page;
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/runtime/server/page/render.js
Expand Up @@ -206,7 +206,7 @@ export async function render_response({
} else {
if (inlined_style) {
const attributes = [];
if (options.dev) attributes.push(' data-svelte');
if (options.dev) attributes.push(' data-sveltekit');
if (csp.style_needs_nonce) attributes.push(` nonce="${csp.nonce}"`);

csp.add_style(inlined_style);
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/test/apps/basics/test/test.js
Expand Up @@ -1527,7 +1527,7 @@ test.describe.parallel('Page options', () => {
expect(await page.textContent('h1')).toBe('content was rendered');
} else {
expect(await page.evaluate(() => document.querySelector('h1'))).toBe(null);
expect(await page.evaluate(() => document.querySelector('style[data-svelte]'))).toBe(null);
expect(await page.evaluate(() => document.querySelector('style[data-sveltekit]'))).toBe(null);
}
});

Expand Down
4 changes: 2 additions & 2 deletions packages/kit/test/apps/options/test/test.js
Expand Up @@ -45,10 +45,10 @@ test.describe.parallel('base path', () => {
test('inlines CSS', async ({ page, javaScriptEnabled }) => {
await page.goto('/path-base/base/');
if (process.env.DEV) {
const ssr_style = await page.evaluate(() => document.querySelector('style[data-svelte]'));
const ssr_style = await page.evaluate(() => document.querySelector('style[data-sveltekit]'));

if (javaScriptEnabled) {
// <style data-svelte> is removed upon hydration
// <style data-sveltekit> is removed upon hydration
expect(ssr_style).toBeNull();
} else {
expect(ssr_style).not.toBeNull();
Expand Down