From fa61d2570e8ab38cd637ca2362dfdb92ee52dacc Mon Sep 17 00:00:00 2001
From: Rich Harris <richard.a.harris@gmail.com>
Date: Sun, 6 May 2018 15:58:19 -0400
Subject: [PATCH] allow spread props on elements with tests for static
 attributes

---
 src/utils/getStaticAttributeValue.ts                 | 2 +-
 test/runtime/samples/spread-element-input/_config.js | 9 +++++++++
 test/runtime/samples/spread-element-input/main.html  | 1 +
 3 files changed, 11 insertions(+), 1 deletion(-)
 create mode 100644 test/runtime/samples/spread-element-input/_config.js
 create mode 100644 test/runtime/samples/spread-element-input/main.html

diff --git a/src/utils/getStaticAttributeValue.ts b/src/utils/getStaticAttributeValue.ts
index c356d84c35..40ef4a1ec5 100644
--- a/src/utils/getStaticAttributeValue.ts
+++ b/src/utils/getStaticAttributeValue.ts
@@ -2,7 +2,7 @@ import { Node } from '../interfaces';
 
 export default function getStaticAttributeValue(node: Node, name: string) {
 	const attribute = node.attributes.find(
-		(attr: Node) => attr.name.toLowerCase() === name
+		(attr: Node) => attr.type === 'Attribute' && attr.name.toLowerCase() === name
 	);
 
 	if (!attribute) return null;
diff --git a/test/runtime/samples/spread-element-input/_config.js b/test/runtime/samples/spread-element-input/_config.js
new file mode 100644
index 0000000000..26f6d9cec2
--- /dev/null
+++ b/test/runtime/samples/spread-element-input/_config.js
@@ -0,0 +1,9 @@
+export default {
+	data: {
+		props: {
+			'data-foo': 'bar'
+		}
+	},
+
+	html: `<input data-foo="bar">`
+};
diff --git a/test/runtime/samples/spread-element-input/main.html b/test/runtime/samples/spread-element-input/main.html
new file mode 100644
index 0000000000..736444749b
--- /dev/null
+++ b/test/runtime/samples/spread-element-input/main.html
@@ -0,0 +1 @@
+<input bind:value {...props}>
\ No newline at end of file