mirror of https://github.com/sveltejs/svelte
parent
40c5df51a2
commit
571011baa4
@ -1,4 +1,4 @@
|
|||||||
export const reserved_keywords = new Set(["$$props", "$$restProps"]);
|
export const reserved_keywords = new Set(["$$props", "$$restProps", "$$host"]);
|
||||||
|
|
||||||
export function is_reserved_keyword(name) {
|
export function is_reserved_keyword(name) {
|
||||||
return reserved_keywords.has(name);
|
return reserved_keywords.has(name);
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
<svelte:options tag="custom-element"/>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export function getHost() {
|
||||||
|
return $$host;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const host = $$host;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{typeof $$host}
|
@ -0,0 +1,12 @@
|
|||||||
|
import * as assert from 'assert';
|
||||||
|
import './main.svelte';
|
||||||
|
|
||||||
|
export default async function (target) {
|
||||||
|
target.innerHTML = '<custom-element></custom-element>';
|
||||||
|
const el = target.querySelector('custom-element');
|
||||||
|
|
||||||
|
assert.equal(el.getHost(), el);
|
||||||
|
assert.equal(el.host, el);
|
||||||
|
|
||||||
|
assert.equal(el.shadowRoot.textContent, 'object');
|
||||||
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
export default {
|
||||||
|
compileOptions: {},
|
||||||
|
error: "$$host is for custom element. Did you forget the 'customElement: true' compile option?"
|
||||||
|
};
|
@ -0,0 +1 @@
|
|||||||
|
{$$host}
|
@ -0,0 +1,4 @@
|
|||||||
|
export default {
|
||||||
|
compileOptions: {},
|
||||||
|
error: "$$host is for custom element. Did you forget the 'customElement: true' compile option?"
|
||||||
|
};
|
@ -0,0 +1,3 @@
|
|||||||
|
<script>
|
||||||
|
export const host = $$host;
|
||||||
|
</script>
|
Loading…
Reference in new issue