You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/src/compile/nodes/shared/AbstractBlock.ts

26 lines
607 B

import Block from '../../render-dom/Block';
import Component from './../../Component';
import Node from './Node';
export default class AbstractBlock extends Node {
block: Block;
children: Node[];
constructor(component: Component, parent, scope, info: any) {
super(component, parent, scope, info);
}
warn_if_empty_block() {
if (!this.children || this.children.length > 1) return;
const child = this.children[0];
if (!child || (child.type === 'Text' && !/[^ \r\n\f\v\t]/.test(child.data))) {
this.component.warn(this, {
code: 'empty-block',
message: 'Empty block'
});
}
}
}