diff --git a/src/validate/html/validateElement.ts b/src/validate/html/validateElement.ts index ce412382c6..3641280f19 100644 --- a/src/validate/html/validateElement.ts +++ b/src/validate/html/validateElement.ts @@ -116,6 +116,10 @@ export default function validateElement(validator: Validator, node: Node, refs: } else if (attribute.type === 'EventHandler') { validateEventHandler(validator, attribute, refCallees); } else if (attribute.type === 'Transition') { + if (isComponent) { + validator.error(`Transitions can only be applied to DOM elements, not components`, attribute.start); + } + const bidi = attribute.intro && attribute.outro; if (hasTransition) { diff --git a/test/validator/samples/transition-on-component/errors.json b/test/validator/samples/transition-on-component/errors.json new file mode 100644 index 0000000000..d18125c8c2 --- /dev/null +++ b/test/validator/samples/transition-on-component/errors.json @@ -0,0 +1,8 @@ +[{ + "message": "Transitions can only be applied to DOM elements, not components", + "loc": { + "line": 1, + "column": 8 + }, + "pos": 8 +}] \ No newline at end of file diff --git a/test/validator/samples/transition-on-component/input.html b/test/validator/samples/transition-on-component/input.html new file mode 100644 index 0000000000..c5ada08ece --- /dev/null +++ b/test/validator/samples/transition-on-component/input.html @@ -0,0 +1,15 @@ + + + \ No newline at end of file