|
|
|
@ -271,21 +271,14 @@ export function clean_nodes(
|
|
|
|
|
|
|
|
|
|
var first = trimmed[0];
|
|
|
|
|
|
|
|
|
|
// initial newline inside a `<pre>` is disregarded, if not followed by another newline
|
|
|
|
|
// if first text node inside a <pre> is a single newline, discard it, because otherwise
|
|
|
|
|
// the browser will do it for us which could break hydration
|
|
|
|
|
if (parent.type === 'RegularElement' && parent.name === 'pre' && first?.type === 'Text') {
|
|
|
|
|
const text = first.data.replace(regex_starts_with_newline, '');
|
|
|
|
|
if (text !== first.data) {
|
|
|
|
|
const tmp = text.replace(regex_starts_with_newline, '');
|
|
|
|
|
if (text === tmp) {
|
|
|
|
|
first.data = text;
|
|
|
|
|
first.raw = first.raw.replace(regex_starts_with_newline, '');
|
|
|
|
|
if (first.data === '') {
|
|
|
|
|
if (first.data === '\n' || first.data === '\r\n') {
|
|
|
|
|
trimmed.shift();
|
|
|
|
|
first = trimmed[0];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Special case: Add a comment if this is a lone script tag. This ensures that our run_scripts logic in template.js
|
|
|
|
|
// will always be able to call node.replaceWith() on the script tag in order to make it run. If we don't add this
|
|
|
|
|