mirror of https://github.com/sveltejs/svelte
fix to apply class directive for svelte:element (#7531)
parent
5242ab9a72
commit
6776fe03fd
@ -0,0 +1,13 @@
|
||||
<script>
|
||||
export let item;
|
||||
</script>
|
||||
|
||||
<svelte:element this="div" class:active={true}>
|
||||
{item.text}
|
||||
</svelte:element>
|
||||
|
||||
<style>
|
||||
.active {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,11 @@
|
||||
export default {
|
||||
html: `
|
||||
<div class="svelte-1vsuzn0 active">foo</div>
|
||||
<div class="svelte-1vsuzn0 active">foo0</div>
|
||||
<div class="svelte-1vsuzn0 active">foo0</div>
|
||||
<div class="svelte-1vsuzn0 active">foo0</div>
|
||||
<div class="svelte-1vsuzn0 active">foo1</div>
|
||||
<div class="svelte-1vsuzn0 active">foo2</div>
|
||||
<div class="svelte-1vsuzn0 active">foo3</div>
|
||||
`
|
||||
};
|
@ -0,0 +1,16 @@
|
||||
<script>
|
||||
import Link from "./Link.svelte";
|
||||
let foo = [
|
||||
{ text: "foo0" },
|
||||
{ text: "foo1" },
|
||||
{ text: "foo2" },
|
||||
{ text: "foo3" },
|
||||
];
|
||||
</script>
|
||||
|
||||
<Link item={{ text: "foo" }} />
|
||||
<Link item={foo[0]} />
|
||||
<Link bind:item={foo[0]} />
|
||||
{#each foo as item}
|
||||
<Link bind:item />
|
||||
{/each}
|
Loading…
Reference in new issue