Skip to content

Commit a3a975f

Browse files
committed
tweak message slightly, so it doesn't sound like the bad element is the one we're currently encountering
1 parent 230f396 commit a3a975f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/svelte/src/html-tree-validation.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,12 @@ export function is_tag_valid_with_parent(tag, parent_tag) {
212212
case 'thead':
213213
case 'tbody':
214214
case 'tfoot':
215-
return `\`<${tag}>\` must be the child of a \`<table>\` (but got \`<${parent_tag}>\`)`;
215+
return `\`<${tag}>\` must be the child of a \`<table>\`, not a \`<${parent_tag}>\``;
216216
case 'td':
217217
case 'th':
218-
return `\`<${tag}>\` must be the child of a \`<tr>\` (but got \`<${parent_tag}>\`)`;
218+
return `\`<${tag}>\` must be the child of a \`<tr>\`, not a \`<${parent_tag}>\``;
219219
case 'tr':
220-
return `\`<tr>\` must be the child of a \`<thead>\`, \`<tbody>\`, or \`<tfoot>\` (but got \`<${parent_tag}>\`)`;
220+
return `\`<tr>\` must be the child of a \`<thead>\`, \`<tbody>\`, or \`<tfoot>\`, not a \`<${parent_tag}>\``;
221221
}
222222

223223
return null;

packages/svelte/tests/validator/samples/invalid-node-placement-7/errors.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[
22
{
33
"code": "node_invalid_placement",
4-
"message": "`<tbody>` must be the child of a `<table>` (but got `<div>`). The browser will 'repair' the HTML (by moving, removing, or inserting elements) which breaks Svelte's assumptions about the structure of your components.",
4+
"message": "`<tbody>` must be the child of a `<table>`, not a `<div>`. The browser will 'repair' the HTML (by moving, removing, or inserting elements) which breaks Svelte's assumptions about the structure of your components.",
55
"start": {
66
"line": 8,
77
"column": 1

0 commit comments

Comments
 (0)