fix: revert shorthand ssr comments (#10980)

* fix: revert shorthand ssr comments

* tests

* add changeset
pull/10987/head
Dominic Gannaway 6 months ago committed by GitHub
parent ef0191a6ae
commit 696b6922e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
"svelte": patch
---
fix: revert SSR shorthand comments

@ -161,11 +161,11 @@ export function element(payload, tag, attributes_fn, children_fn) {
if (!VoidElements.has(tag)) {
if (tag !== 'textarea') {
payload.out += '<![>';
payload.out += '<!--[-->';
}
children_fn();
if (tag !== 'textarea') {
payload.out += '<!]>';
payload.out += '<!--]-->';
}
payload.out += `</${tag}>`;
}
@ -187,7 +187,7 @@ export function render(component, options) {
const prev_on_destroy = on_destroy;
on_destroy = [];
payload.out += '<![>';
payload.out += '<!--[-->';
if (options.context) {
push();
@ -200,14 +200,14 @@ export function render(component, options) {
pop();
}
payload.out += '<!]>';
payload.out += '<!--]-->';
for (const cleanup of on_destroy) cleanup();
on_destroy = prev_on_destroy;
return {
head:
payload.head.out || payload.head.title
? payload.head.title + '<![>' + payload.head.out + '<!]>'
? payload.head.title + '<!--[-->' + payload.head.out + '<!--]-->'
: '',
html: payload.out
};
@ -271,15 +271,15 @@ export function attr(name, value, boolean) {
export function css_props(payload, is_html, props, component) {
const styles = style_object_to_string(props);
if (is_html) {
payload.out += `<div style="display: contents; ${styles}"><![>`;
payload.out += `<div style="display: contents; ${styles}"><!--[-->`;
} else {
payload.out += `<g style="${styles}"><![>`;
payload.out += `<g style="${styles}"><!--[-->`;
}
component();
if (is_html) {
payload.out += `<!]></div>`;
payload.out += `<!--]--></div>`;
} else {
payload.out += `<!]></g>`;
payload.out += `<!--]--></g>`;
}
}

@ -44,7 +44,6 @@
"column": 0
}
},
"leadingComments": [{ "type": "Line", "value": "should not error out" }],
"body": [
{
"type": "VariableDeclaration",
@ -127,7 +126,13 @@
"kind": "let"
}
],
"sourceType": "module"
"sourceType": "module",
"leadingComments": [
{
"type": "Line",
"value": "should not error out"
}
]
}
}
}

@ -1 +1 @@
<![><div>Just a dummy page.</div><!]>
<!--[--><div>Just a dummy page.</div><!--]-->

Loading…
Cancel
Save