Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix using value$ on input element #2673

Merged
merged 1 commit into from
Nov 18, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/annotations/annotations.html
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,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 @@ -434,20 +434,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