mirror of
https://github.com/sveltejs/svelte.git
synced 2024-11-30 00:46:29 +01:00
dont warn on empty block for nbsp - fixes #1658
This commit is contained in:
parent
4890d4dc02
commit
c52a6f011b
@ -14,7 +14,7 @@ function isEmptyBlock(node: Node) {
|
||||
if (!/Block$/.test(node.type) || !node.children) return false;
|
||||
if (node.children.length > 1) return false;
|
||||
const child = node.children[0];
|
||||
return !child || (child.type === 'Text' && !/\S/.test(child.data));
|
||||
return !child || (child.type === 'Text' && !/[^ \r\n\f\v\t]/.test(child.data));
|
||||
}
|
||||
|
||||
export default function validateHtml(validator: Validator, html: Node) {
|
||||
|
3
test/validator/samples/non-empty-block-dev/_config.js
Normal file
3
test/validator/samples/non-empty-block-dev/_config.js
Normal file
@ -0,0 +1,3 @@
|
||||
export default {
|
||||
dev: true
|
||||
};
|
3
test/validator/samples/non-empty-block-dev/input.html
Normal file
3
test/validator/samples/non-empty-block-dev/input.html
Normal file
@ -0,0 +1,3 @@
|
||||
{#if x}
|
||||
|
||||
{/if}
|
1
test/validator/samples/non-empty-block-dev/warnings.json
Normal file
1
test/validator/samples/non-empty-block-dev/warnings.json
Normal file
@ -0,0 +1 @@
|
||||
[]
|
Loading…
Reference in New Issue
Block a user