diff --git a/src/runtime/internal/dom.ts b/src/runtime/internal/dom.ts
index 34049b3580f9..8a78accb50c3 100644
--- a/src/runtime/internal/dom.ts
+++ b/src/runtime/internal/dom.ts
@@ -306,6 +306,15 @@ export function attr(node: Element, attribute: string, value?: string) {
else if (node.getAttribute(attribute) !== value) node.setAttribute(attribute, value);
}
+/**
+ * List of attributes that should always be set through the attr method,
+ * because updating them through the property setter doesn't work reliably.
+ * In the example of `width`/`height`, the problem is that the setter only
+ * accepts numeric values, but the attribute can also be set to a string like `50%`.
+ * If this list becomes too big, rethink this approach.
+ */
+const always_set_through_set_attribute = ['width', 'height'];
+
export function set_attributes(node: Element & ElementCSSInlineStyle, attributes: { [x: string]: string }) {
// @ts-ignore
const descriptors = Object.getOwnPropertyDescriptors(node.__proto__);
@@ -316,7 +325,7 @@ export function set_attributes(node: Element & ElementCSSInlineStyle, attributes
node.style.cssText = attributes[key];
} else if (key === '__value') {
(node as any).value = node[key] = attributes[key];
- } else if (descriptors[key] && descriptors[key].set) {
+ } else if (descriptors[key] && descriptors[key].set && always_set_through_set_attribute.indexOf(key) === -1) {
node[key] = attributes[key];
} else {
attr(node, key, attributes[key]);
diff --git a/test/runtime/samples/spread-width-height-attributes/_config.js b/test/runtime/samples/spread-width-height-attributes/_config.js
new file mode 100644
index 000000000000..cf2dc7efdee5
--- /dev/null
+++ b/test/runtime/samples/spread-width-height-attributes/_config.js
@@ -0,0 +1,4 @@
+export default {
+ // https://github.com/sveltejs/svelte/issues/6752
+ html: ''
+};
diff --git a/test/runtime/samples/spread-width-height-attributes/main.svelte b/test/runtime/samples/spread-width-height-attributes/main.svelte
new file mode 100644
index 000000000000..b91b00845738
--- /dev/null
+++ b/test/runtime/samples/spread-width-height-attributes/main.svelte
@@ -0,0 +1 @@
+