All files / src/compiler/phases/2-analyze/visitors SvelteBody.js

92% Statements 23/25
75% Branches 3/4
100% Functions 1/1
90.9% Lines 20/22

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 232x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 12x 12x 14x 14x 14x 14x     14x 12x 12x  
/** @import { AST } from '#compiler' */
/** @import { Context } from '../types' */
import * as e from '../../../errors.js';
import { is_event_attribute } from '../../../utils/ast.js';
import { disallow_children } from './shared/special-element.js';
 
/**
 * @param {AST.SvelteBody} node
 * @param {Context} context
 */
export function SvelteBody(node, context) {
	disallow_children(node);
	for (const attribute of node.attributes) {
		if (
			attribute.type === 'SpreadAttribute' ||
			(attribute.type === 'Attribute' && !is_event_attribute(attribute))
		) {
			e.svelte_body_illegal_attribute(attribute);
		}
	}
	context.next();
}