mirror of https://github.com/sveltejs/svelte
* feat: make svelte:option customElement tag property optional (#12751) * tweak comment * tweak docs * tweak some more wording * Update .changeset/four-kids-flow.md --------- Co-authored-by: Rich Harris <rich.harris@vercel.com> Co-authored-by: Rich Harris <hello@rich-harris.dev>pull/12797/head
parent
97c0150b00
commit
7ae21ea97d
@ -0,0 +1,5 @@
|
||||
---
|
||||
"svelte": minor
|
||||
---
|
||||
|
||||
feat: make custom element `tag` property optional
|
@ -0,0 +1,18 @@
|
||||
import { test } from '../../assert';
|
||||
const tick = () => Promise.resolve();
|
||||
|
||||
export default test({
|
||||
warnings: [],
|
||||
async test({ assert, target, componentCtor }) {
|
||||
customElements.define('no-tag', componentCtor.element);
|
||||
target.innerHTML = '<no-tag name="world"></no-tag>';
|
||||
await tick();
|
||||
|
||||
/** @type {any} */
|
||||
const el = target.querySelector('no-tag');
|
||||
const h1 = el.querySelector('h1');
|
||||
|
||||
assert.equal(el.shadowRoot, null);
|
||||
assert.equal(h1.textContent, 'Hello world!');
|
||||
}
|
||||
});
|
@ -0,0 +1,7 @@
|
||||
<svelte:options customElement={{ shadow: "none" }} />
|
||||
|
||||
<script>
|
||||
export let name;
|
||||
</script>
|
||||
|
||||
<h1>Hello {name}!</h1>
|
Loading…
Reference in new issue