mirror of https://github.com/sveltejs/svelte
fix: attach __svelte_meta correctly to elements following a CSS wrapper (#15982)
* fix: attach __svelte_meta correctly to elements following a CSS wrapper * Update .changeset/nervous-hotels-clean.mdpull/15978/head
parent
c03ea47e4e
commit
50de8c5317
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: attach `__svelte_meta` correctly to elements following a CSS wrapper
|
@ -0,0 +1,7 @@
|
|||||||
|
<h2>hello from component</h2>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
h2 {
|
||||||
|
color: var(--color);
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,42 @@
|
|||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
compileOptions: {
|
||||||
|
dev: true
|
||||||
|
},
|
||||||
|
|
||||||
|
html: `
|
||||||
|
<h1>hello</h1>
|
||||||
|
<svelte-css-wrapper style="display: contents; --color: red;">
|
||||||
|
<h2 class="svelte-13kae5a">hello from component</h2>
|
||||||
|
</svelte-css-wrapper>
|
||||||
|
<p>goodbye</p>
|
||||||
|
`,
|
||||||
|
|
||||||
|
async test({ target, assert }) {
|
||||||
|
const h1 = target.querySelector('h1');
|
||||||
|
const h2 = target.querySelector('h2');
|
||||||
|
const p = target.querySelector('p');
|
||||||
|
|
||||||
|
// @ts-expect-error
|
||||||
|
assert.deepEqual(h1.__svelte_meta.loc, {
|
||||||
|
file: 'main.svelte',
|
||||||
|
line: 5,
|
||||||
|
column: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
// @ts-expect-error
|
||||||
|
assert.deepEqual(h2.__svelte_meta.loc, {
|
||||||
|
file: 'Component.svelte',
|
||||||
|
line: 1,
|
||||||
|
column: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
// @ts-expect-error
|
||||||
|
assert.deepEqual(p.__svelte_meta.loc, {
|
||||||
|
file: 'main.svelte',
|
||||||
|
line: 7,
|
||||||
|
column: 0
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,7 @@
|
|||||||
|
<script>
|
||||||
|
import Component from './Component.svelte';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<h1>hello</h1>
|
||||||
|
<Component --color="red" />
|
||||||
|
<p>goodbye</p>
|
Loading…
Reference in new issue