From 4e99eb8d377af30f7c556d17a81cb2309f5882ea Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Wed, 14 Mar 2018 16:55:38 -0400 Subject: [PATCH] use setAttribute with inputs, for benefit of IE - fixes #1209 --- src/generators/nodes/Attribute.ts | 1 - .../samples/input-without-blowback-guard/expected-bundle.js | 6 +++++- test/js/samples/input-without-blowback-guard/expected.js | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/generators/nodes/Attribute.ts b/src/generators/nodes/Attribute.ts index 57b387d20b60..90031d261e19 100644 --- a/src/generators/nodes/Attribute.ts +++ b/src/generators/nodes/Attribute.ts @@ -518,7 +518,6 @@ const attributeLookup = { type: { appliesTo: [ 'button', - 'input', 'command', 'embed', 'object', diff --git a/test/js/samples/input-without-blowback-guard/expected-bundle.js b/test/js/samples/input-without-blowback-guard/expected-bundle.js index 0b5089c08dee..2e27d4c2bc49 100644 --- a/test/js/samples/input-without-blowback-guard/expected-bundle.js +++ b/test/js/samples/input-without-blowback-guard/expected-bundle.js @@ -33,6 +33,10 @@ function removeListener(node, event, handler) { node.removeEventListener(event, handler, false); } +function setAttribute(node, attribute, value) { + node.setAttribute(attribute, value); +} + function blankObject() { return Object.create(null); } @@ -206,7 +210,7 @@ function create_main_fragment(component, state) { h: function hydrate() { addListener(input, "change", input_change_handler); - input.type = "checkbox"; + setAttribute(input, "type", "checkbox"); }, m: function mount(target, anchor) { diff --git a/test/js/samples/input-without-blowback-guard/expected.js b/test/js/samples/input-without-blowback-guard/expected.js index 307a26c53c90..ba99db454176 100644 --- a/test/js/samples/input-without-blowback-guard/expected.js +++ b/test/js/samples/input-without-blowback-guard/expected.js @@ -1,5 +1,5 @@ /* generated by Svelte vX.Y.Z */ -import { addListener, assign, createElement, detachNode, init, insertNode, proto, removeListener } from "svelte/shared.js"; +import { addListener, assign, createElement, detachNode, init, insertNode, proto, removeListener, setAttribute } from "svelte/shared.js"; function create_main_fragment(component, state) { var input; @@ -16,7 +16,7 @@ function create_main_fragment(component, state) { h: function hydrate() { addListener(input, "change", input_change_handler); - input.type = "checkbox"; + setAttribute(input, "type", "checkbox"); }, m: function mount(target, anchor) {