mirror of https://github.com/sveltejs/svelte
fix: only inject push/pop/$$props in SSR components when necessary (#11771)
parent
9084f1796b
commit
d1f5d5d33d
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: only inject push/pop in SSR components when necessary
|
@ -1,9 +1,7 @@
|
||||
import * as $ from "svelte/internal/server";
|
||||
|
||||
export default function Bind_this($$payload, $$props) {
|
||||
$.push();
|
||||
export default function Bind_this($$payload) {
|
||||
$$payload.out += `<!--[-->`;
|
||||
Foo($$payload, {});
|
||||
$$payload.out += `<!--]-->`;
|
||||
$.pop();
|
||||
}
|
@ -1,12 +1,9 @@
|
||||
import * as $ from "svelte/internal/server";
|
||||
|
||||
export default function Main($$payload, $$props) {
|
||||
$.push();
|
||||
|
||||
export default function Main($$payload) {
|
||||
// needs to be a snapshot test because jsdom does auto-correct the attribute casing
|
||||
let x = 'test';
|
||||
let y = () => 'test';
|
||||
|
||||
$$payload.out += `<div${$.attr("foobar", x, false)}></div> <svg${$.attr("viewBox", x, false)}></svg> <custom-element${$.attr("foobar", x, false)}></custom-element> <div${$.attr("foobar", y(), false)}></div> <svg${$.attr("viewBox", y(), false)}></svg> <custom-element${$.attr("foobar", y(), false)}></custom-element>`;
|
||||
$.pop();
|
||||
}
|
@ -1,7 +1,5 @@
|
||||
import * as $ from "svelte/internal/server";
|
||||
|
||||
export default function Hello_world($$payload, $$props) {
|
||||
$.push();
|
||||
export default function Hello_world($$payload) {
|
||||
$$payload.out += `<h1>hello world</h1>`;
|
||||
$.pop();
|
||||
}
|
@ -1,7 +1,5 @@
|
||||
import * as $ from "svelte/internal/server";
|
||||
|
||||
export default function Hmr($$payload, $$props) {
|
||||
$.push();
|
||||
export default function Hmr($$payload) {
|
||||
$$payload.out += `<h1>hello world</h1>`;
|
||||
$.pop();
|
||||
}
|
@ -1,12 +1,9 @@
|
||||
import * as $ from "svelte/internal/server";
|
||||
|
||||
export default function Svelte_element($$payload, $$props) {
|
||||
$.push();
|
||||
|
||||
let { tag = 'hr' } = $$props;
|
||||
|
||||
$$payload.out += `<!--[-->`;
|
||||
if (tag) $.element($$payload, tag, () => {}, () => {});
|
||||
$$payload.out += `<!--]-->`;
|
||||
$.pop();
|
||||
}
|
Loading…
Reference in new issue