mirror of https://github.com/sveltejs/svelte
apply class for dynamic elements (#7652)
parent
78a249be36
commit
e2ef2b8731
@ -0,0 +1,3 @@
|
|||||||
|
export default {
|
||||||
|
warnings: []
|
||||||
|
};
|
||||||
@ -0,0 +1 @@
|
|||||||
|
div.svelte-xyz.svelte-xyz.svelte-xyz{color:red}h2.svelte-xyz>p.svelte-xyz.svelte-xyz{color:red}h2.svelte-xyz span.svelte-xyz.svelte-xyz{color:red}h2.svelte-xyz>span.svelte-xyz>b.svelte-xyz{color:red}h2.svelte-xyz span b.svelte-xyz.svelte-xyz{color:red}h2.svelte-xyz b.svelte-xyz.svelte-xyz{color:red}
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
<div class="svelte-xyz"></div>
|
||||||
|
<h2 class="svelte-xyz">
|
||||||
|
<div class="svelte-xyz"><b class="svelte-xyz">text</b></div>
|
||||||
|
</h2>
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
<script>
|
||||||
|
export let element = 'div';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<svelte:element this={element} />
|
||||||
|
|
||||||
|
<h2>
|
||||||
|
<svelte:element this={element}>
|
||||||
|
<b>text</b>
|
||||||
|
</svelte:element>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
div {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
h2 > p {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
h2 span {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
h2 > span > b {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
h2 span b {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
h2 b {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
Reference in new issue