Skip to content

Commit bc72ed2

Browse files
committed
fix error
1 parent acb3cd0 commit bc72ed2

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

documentation/docs/98-reference/.generated/compile-errors.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,12 @@ A component can have a single top-level `<style>` element
762762
`<svelte:body>` does not support non-event attributes or spread attributes
763763
```
764764

765+
### svelte_boundary_invalid_attribute
766+
767+
```
768+
Valid attributes on `<svelte:boundary>` are `onerror` and `failed`
769+
```
770+
765771
### svelte_component_invalid_this
766772

767773
```

packages/svelte/messages/compile-errors/template.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,10 @@ HTML restricts where certain elements can appear. In case of a violation the bro
282282

283283
> `<svelte:body>` does not support non-event attributes or spread attributes
284284
285+
## svelte_boundary_invalid_attribute
286+
287+
> Valid attributes on `<svelte:boundary>` are `onerror` and `failed`
288+
285289
## svelte_component_invalid_this
286290

287291
> Invalid component definition — must be an `{expression}`

packages/svelte/src/compiler/errors.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,4 +1508,13 @@ export function unexpected_reserved_word(node, word) {
15081508
*/
15091509
export function void_element_invalid_content(node) {
15101510
e(node, "void_element_invalid_content", "Void elements cannot have children or closing tags");
1511+
}
1512+
1513+
/**
1514+
* Valid attributes on `<svelte:boundary>` are `onerror` and `failed`
1515+
* @param {null | number | NodeLike} node
1516+
* @returns {never}
1517+
*/
1518+
export function svelte_boundary_invalid_attribute(node) {
1519+
e(node, "svelte_boundary_invalid_attribute", "Valid attributes on `<svelte:boundary>` are `onerror` and `failed`");
15111520
}

packages/svelte/src/compiler/phases/2-analyze/visitors/SvelteBoundary.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
/** @import { Context } from '../types' */
33
import * as e from '../../../errors.js';
44

5+
const valid = ['onerror', 'failed'];
6+
57
/**
68
* @param {AST.SvelteBoundary} node
79
* @param {Context} context
810
*/
911
export function SvelteBoundary(node, context) {
1012
for (const attribute of node.attributes) {
11-
if (attribute.type !== 'Attribute') {
12-
e.illegal_element_attribute(attribute, 'svelte:boundary');
13+
if (attribute.type !== 'Attribute' || !valid.includes(attribute.name)) {
14+
e.svelte_boundary_invalid_attribute(attribute);
1315
}
1416
}
1517

0 commit comments

Comments
 (0)