mirror of https://github.com/sveltejs/svelte
parent
27ee8fd26d
commit
8e5a160af9
@ -0,0 +1,12 @@
|
||||
/** @import { SvelteBody } from '#compiler' */
|
||||
/** @import { Context } from '../types' */
|
||||
import { disallow_children } from './shared/special-element.js';
|
||||
|
||||
/**
|
||||
* @param {SvelteBody} node
|
||||
* @param {Context} context
|
||||
*/
|
||||
export function SvelteBody(node, context) {
|
||||
disallow_children(node);
|
||||
context.next();
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
/** @import { SvelteDocument } from '#compiler' */
|
||||
/** @import { Context } from '../types' */
|
||||
import { disallow_children } from './shared/special-element.js';
|
||||
|
||||
/**
|
||||
* @param {SvelteDocument} node
|
||||
* @param {Context} context
|
||||
*/
|
||||
export function SvelteDocument(node, context) {
|
||||
disallow_children(node);
|
||||
context.next();
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
/** @import { SvelteWindow } from '#compiler' */
|
||||
/** @import { Context } from '../types' */
|
||||
import { disallow_children } from './shared/special-element.js';
|
||||
|
||||
/**
|
||||
* @param {SvelteWindow} node
|
||||
* @param {Context} context
|
||||
*/
|
||||
export function SvelteWindow(node, context) {
|
||||
disallow_children(node);
|
||||
context.next();
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
/** @import { SvelteBody, SvelteDocument, SvelteWindow } from '#compiler' */
|
||||
import * as e from '../../../../errors.js';
|
||||
|
||||
/**
|
||||
* @param {SvelteBody | SvelteDocument | SvelteWindow} node
|
||||
*/
|
||||
export function disallow_children(node) {
|
||||
const { nodes } = node.fragment;
|
||||
|
||||
if (nodes.length > 0) {
|
||||
const first = nodes[0];
|
||||
const last = nodes[nodes.length - 1];
|
||||
|
||||
e.svelte_meta_invalid_content({ start: first.start, end: last.end }, node.name);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue