Skip to content

Commit

Permalink
use setAttribute with inputs, for benefit of IE - fixes #1209
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Mar 14, 2018
1 parent 0ac7701 commit 4e99eb8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/generators/nodes/Attribute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,6 @@ const attributeLookup = {
type: {
appliesTo: [
'button',
'input',
'command',
'embed',
'object',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions test/js/samples/input-without-blowback-guard/expected.js
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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) {
Expand Down

0 comments on commit 4e99eb8

Please sign in to comment.