diff --git a/src/compile/Component.ts b/src/compile/Component.ts index 4a249d2287..cf673bf62f 100644 --- a/src/compile/Component.ts +++ b/src/compile/Component.ts @@ -227,8 +227,17 @@ export default class Component { if (options.customElement === true) { this.customElement = { - tag: this.tag, - props: this.props + tag: null, + props: [] // TODO!!! + }; + + // find tag + const meta = this.ast.html.children.find(node => node.name === 'svelte:meta'); + if (meta) { + const tag_attribute = meta.attributes.find(a => a.name === 'tag'); + if (tag_attribute) { + this.customElement.tag = tag_attribute.value[0].data; + } } } else { this.customElement = options.customElement; diff --git a/src/compile/nodes/Meta.ts b/src/compile/nodes/Meta.ts new file mode 100644 index 0000000000..6477ba4fcd --- /dev/null +++ b/src/compile/nodes/Meta.ts @@ -0,0 +1,6 @@ +import Node from './shared/Node'; + +export default class Meta extends Node { + type: 'Meta'; + data: string; +} \ No newline at end of file diff --git a/src/compile/nodes/shared/mapChildren.ts b/src/compile/nodes/shared/mapChildren.ts index a59705a8a7..775f72dc16 100644 --- a/src/compile/nodes/shared/mapChildren.ts +++ b/src/compile/nodes/shared/mapChildren.ts @@ -6,6 +6,7 @@ import Element from '../Element'; import Head from '../Head'; import IfBlock from '../IfBlock'; import InlineComponent from '../InlineComponent'; +import Meta from '../Meta'; import MustacheTag from '../MustacheTag'; import RawMustacheTag from '../RawMustacheTag'; import DebugTag from '../DebugTag'; @@ -25,6 +26,7 @@ function getConstructor(type): typeof Node { case 'Head': return Head; case 'IfBlock': return IfBlock; case 'InlineComponent': return InlineComponent; + case 'Meta': return Meta; case 'MustacheTag': return MustacheTag; case 'RawMustacheTag': return RawMustacheTag; case 'DebugTag': return DebugTag;