Skip to content

Commit

Permalink
Merge pull request #2673 from JeremybellEU/input-value-annotated
Browse files Browse the repository at this point in the history
Fix using value$ on input element
  • Loading branch information
kevinpschaaf committed Nov 18, 2015
2 parents 0345137 + 05a1e95 commit cfa6d51
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/lib/annotations/annotations.html
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@
// `value` attribute if it previously had a value (can't
// unconditionally set '' before removing since attributes with `$`
// can't be set using setAttribute)
if (node.localName == 'input' && name == 'value') {
if (node.localName === 'input' && origName === 'value') {
node.setAttribute(origName, '');
}
// Remove annotation
Expand Down
36 changes: 21 additions & 15 deletions test/unit/bind-elements.html
Original file line number Diff line number Diff line change
Expand Up @@ -435,20 +435,26 @@
</script>

<dom-module id="x-entity-and-binding">
<template>
<p>&copy;</p>
<p id="binding">{{myText}}</p>
</template>
</dom-module>
<template>
<p>&copy;</p>
<p id="binding">{{myText}}</p>
</template>
</dom-module>

<script>
Polymer({
is: "x-entity-and-binding",
properties: {
myText: {
type: String,
value: 'binding'
}
<script>
Polymer({
is: "x-entity-and-binding",
properties: {
myText: {
type: String,
value: 'binding'
}
});
</script>
}
});
</script>

<dom-module id="x-input-value">
<template>
<input id="input" value$="{{inputValue}}">
</template>
</dom-module>
12 changes: 11 additions & 1 deletion test/unit/bind.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
<link rel="import" href="../../polymer.html">
<link rel="import" href="bind-elements.html">
<body>

<script>

suite('single-element binding effects', function() {
Expand Down Expand Up @@ -595,6 +594,17 @@
assert(!el.$.boundChild.hasAttribute('attrvalue'));
});

test('bind to value attribute on input should not fail', function() {
Polymer({
is: 'x-input-value'
});

var el = document.createElement('x-input-value');
el.inputValue = "the value";
assert.equal(el.$.input.value, "the value", "The value of the input is not propagated");
assert.equal(el.$.input.value$, undefined, "value$ should be removed from input");
});

});

suite('avoid non-bubbling event gotchas', function() {
Expand Down

0 comments on commit cfa6d51

Please sign in to comment.