Skip to content

Commit

Permalink
[chore] rename data-svelte to data-sveltekit (#4641)
Browse files Browse the repository at this point in the history
* [chore] rename data-svelte to data-sveltekit

* Create tiny-hounds-glow.md

Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
  • Loading branch information
benmccann and Rich-Harris committed Apr 18, 2022
1 parent d14e0ac commit eaa8a05
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
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

0 comments on commit eaa8a05

Please sign in to comment.