Skip to content

Commit 502f6b6

Browse files
authored
Merge pull request #793 from sveltejs/gh-791
error if component has transition
2 parents 56677a2 + cb92f30 commit 502f6b6

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

src/validate/html/validateElement.ts

+4
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ export default function validateElement(validator: Validator, node: Node, refs:
116116
} else if (attribute.type === 'EventHandler') {
117117
validateEventHandler(validator, attribute, refCallees);
118118
} else if (attribute.type === 'Transition') {
119+
if (isComponent) {
120+
validator.error(`Transitions can only be applied to DOM elements, not components`, attribute.start);
121+
}
122+
119123
const bidi = attribute.intro && attribute.outro;
120124

121125
if (hasTransition) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[{
2+
"message": "Transitions can only be applied to DOM elements, not components",
3+
"loc": {
4+
"line": 1,
5+
"column": 8
6+
},
7+
"pos": 8
8+
}]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Widget in:foo/>
2+
3+
<script>
4+
import Widget from './Widget.html';
5+
6+
export default {
7+
components: {
8+
Widget
9+
},
10+
11+
transitions: {
12+
foo() {}
13+
}
14+
};
15+
</script>

0 commit comments

Comments
 (0)