diff --git a/src/generators/server-side-rendering/visitors/Element.ts b/src/generators/server-side-rendering/visitors/Element.ts
index 62c1fc87032a..fbce71974baf 100644
--- a/src/generators/server-side-rendering/visitors/Element.ts
+++ b/src/generators/server-side-rendering/visitors/Element.ts
@@ -35,22 +35,25 @@ export default function visitElement(
}
node.attributes.forEach((attribute: Node) => {
- if (attribute.type !== 'Attribute') return;
-
- if (attribute.name === 'value' && node.name === 'textarea') {
- textareaContents = stringifyAttributeValue(block, attribute.value);
- } else if (attribute.value === true) {
- openingTag += ` ${attribute.name}`;
- } else if (
- booleanAttributes.has(attribute.name) &&
- attribute.value.length === 1 &&
- attribute.value[0].type !== 'Text'
- ) {
- // a boolean attribute with one non-Text chunk
- block.contextualise(attribute.value[0].expression);
- openingTag += '${' + attribute.value[0].metadata.snippet + ' ? " ' + attribute.name + '" : "" }';
- } else {
- openingTag += ` ${attribute.name}="${stringifyAttributeValue(block, attribute.value)}"`;
+ if (attribute.type === 'Attribute') {
+ if (attribute.name === 'value' && node.name === 'textarea') {
+ textareaContents = stringifyAttributeValue(block, attribute.value);
+ } else if (attribute.value === true) {
+ openingTag += ` ${attribute.name}`;
+ } else if (
+ booleanAttributes.has(attribute.name) &&
+ attribute.value.length === 1 &&
+ attribute.value[0].type !== 'Text'
+ ) {
+ // a boolean attribute with one non-Text chunk
+ block.contextualise(attribute.value[0].expression);
+ openingTag += '${' + attribute.value[0].metadata.snippet + ' ? " ' + attribute.name + '" : "" }';
+ } else {
+ openingTag += ` ${attribute.name}="${stringifyAttributeValue(block, attribute.value)}"`;
+ }
+ } else if (attribute.type === 'Binding') {
+ block.contextualise(attribute.value); // TODO gah this is hacky, contextualise everything upfront
+ openingTag += '${' + attribute.metadata.snippet + ' === false ? "" : " ' + attribute.name + '" + (' + attribute.metadata.snippet + ' === true ? "" : "=" + JSON.stringify(' + attribute.metadata.snippet + '))}';
}
});
diff --git a/test/server-side-rendering/samples/binding/_expected.html b/test/server-side-rendering/samples/binding/_expected.html
new file mode 100644
index 000000000000..fd3487caa76f
--- /dev/null
+++ b/test/server-side-rendering/samples/binding/_expected.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/test/server-side-rendering/samples/binding/main.html b/test/server-side-rendering/samples/binding/main.html
new file mode 100644
index 000000000000..f81c39df8cd4
--- /dev/null
+++ b/test/server-side-rendering/samples/binding/main.html
@@ -0,0 +1,9 @@
+
+
+
\ No newline at end of file