diff --git a/src/compiler/compile/render_ssr/handlers/Element.ts b/src/compiler/compile/render_ssr/handlers/Element.ts index ad5c421bc4..e33ca9ea56 100644 --- a/src/compiler/compile/render_ssr/handlers/Element.ts +++ b/src/compiler/compile/render_ssr/handlers/Element.ts @@ -124,7 +124,7 @@ export default function(node: Element, renderer: Renderer, options: RenderOption node_contents = x`${snippet} || ""`; } else { const snippet = expression.node; - renderer.add_expression(x`@add_attribute("${name}", ${snippet}, 1)`); + renderer.add_expression(x`@add_attribute("${name}", ${snippet}, 0)`); } }); diff --git a/src/runtime/internal/ssr.ts b/src/runtime/internal/ssr.ts index 0e03afb0db..646a81d817 100644 --- a/src/runtime/internal/ssr.ts +++ b/src/runtime/internal/ssr.ts @@ -128,7 +128,7 @@ export function create_ssr_component(fn) { } export function add_attribute(name, value, boolean) { - if (value == null || (boolean && !value && value !== 0)) return ''; + if (value == null || (boolean && !value)) return ''; return ` ${name}${value === true ? '' : `=${typeof value === 'string' ? JSON.stringify(escape(value)) : `"${value}"`}`}`; } diff --git a/test/runtime/samples/apply-directives-in-order/_config.js b/test/runtime/samples/apply-directives-in-order/_config.js index e5e8980ed1..03cdc24645 100644 --- a/test/runtime/samples/apply-directives-in-order/_config.js +++ b/test/runtime/samples/apply-directives-in-order/_config.js @@ -9,7 +9,7 @@ export default { `, ssrHtml: ` - +
`, diff --git a/test/runtime/samples/binding-indirect-computed/_config.js b/test/runtime/samples/binding-indirect-computed/_config.js index 7519c4b0ed..9834d0a228 100644 --- a/test/runtime/samples/binding-indirect-computed/_config.js +++ b/test/runtime/samples/binding-indirect-computed/_config.js @@ -11,6 +11,14 @@ export default { `, + ssrHtml: ` + + `, + async test({ assert, component, target, window }) { const select = target.querySelector('select'); const options = target.querySelectorAll('option'); diff --git a/test/runtime/samples/binding-input-checkbox-deep-contextual-b/_config.js b/test/runtime/samples/binding-input-checkbox-deep-contextual-b/_config.js index 539a07312b..a4c9dacb6e 100644 --- a/test/runtime/samples/binding-input-checkbox-deep-contextual-b/_config.js +++ b/test/runtime/samples/binding-input-checkbox-deep-contextual-b/_config.js @@ -13,13 +13,13 @@ export default { ssrHtml: `one
+one
two
+two
three
+three
one
two
+two
three
+three
1 completed
`, diff --git a/test/runtime/samples/binding-input-checkbox-with-event-in-each/_config.js b/test/runtime/samples/binding-input-checkbox-with-event-in-each/_config.js index b502ed40af..1ce561647f 100644 --- a/test/runtime/samples/binding-input-checkbox-with-event-in-each/_config.js +++ b/test/runtime/samples/binding-input-checkbox-with-event-in-each/_config.js @@ -17,6 +17,11 @@ export default { `, + ssrHtml: ` + + + `, + test({ assert, component, target, window }) { const { cats } = component; const newCats = cats.slice(); diff --git a/test/runtime/samples/binding-input-text-contextual-reactive/_config.js b/test/runtime/samples/binding-input-text-contextual-reactive/_config.js index 6fdfc4be52..91f243a8b6 100644 --- a/test/runtime/samples/binding-input-text-contextual-reactive/_config.js +++ b/test/runtime/samples/binding-input-text-contextual-reactive/_config.js @@ -26,7 +26,7 @@ export default { ssrHtml: `one
two
three