diff --git a/src/generators/nodes/Slot.ts b/src/generators/nodes/Slot.ts index 896a65959c..1a1b5f6851 100644 --- a/src/generators/nodes/Slot.ts +++ b/src/generators/nodes/Slot.ts @@ -136,16 +136,16 @@ export default class Slot extends Element { getStaticAttributeValue(name: string) { const attribute = this.attributes.find( - (attr: Node) => attr.name.toLowerCase() === name + attr => attr.name.toLowerCase() === name ); if (!attribute) return null; - if (attribute.value === true) return true; - if (attribute.value.length === 0) return ''; + if (attribute.isTrue) return true; + if (attribute.chunks.length === 0) return ''; - if (attribute.value.length === 1 && attribute.value[0].type === 'Text') { - return attribute.value[0].data; + if (attribute.chunks.length === 1 && attribute.chunks[0].type === 'Text') { + return attribute.chunks[0].data; } return null; diff --git a/src/validate/html/validateElement.ts b/src/validate/html/validateElement.ts index 2a32769797..7d8d19d188 100644 --- a/src/validate/html/validateElement.ts +++ b/src/validate/html/validateElement.ts @@ -295,9 +295,11 @@ function checkSlotAttribute(validator: Validator, node: Node, attribute: Node, s let i = stack.length; while (i--) { const parent = stack[i]; - if (parent.type === 'Element') { + + if (parent.type === 'Component') { // if we're inside a component or a custom element, gravy if (parent.name === 'svelte:self' || parent.name === 'svelte:component' || validator.components.has(parent.name)) return; + } else if (parent.type === 'Element') { if (/-/.test(parent.name)) return; }