| Index: third_party/polymer/v1_0/components-chromium/paper-input/paper-input-behavior-extracted.js
|
| diff --git a/third_party/polymer/v1_0/components-chromium/paper-input/paper-input-behavior-extracted.js b/third_party/polymer/v1_0/components-chromium/paper-input/paper-input-behavior-extracted.js
|
| index 2a0d54c4b5aec7eec1da66aeb551c8131412d8d0..ff51360788b29438ffbe1d82570acb845d4747a6 100644
|
| --- a/third_party/polymer/v1_0/components-chromium/paper-input/paper-input-behavior-extracted.js
|
| +++ b/third_party/polymer/v1_0/components-chromium/paper-input/paper-input-behavior-extracted.js
|
| @@ -190,7 +190,9 @@
|
| * A placeholder string in addition to the label. If this is set, the label will always float.
|
| */
|
| placeholder: {
|
| - type: String
|
| + type: String,
|
| + // need to set a default so _computeAlwaysFloatLabel is run
|
| + value: ''
|
| },
|
|
|
| /**
|
| @@ -253,10 +255,32 @@
|
| /**
|
| * Validates the input element and sets an error style if needed.
|
| */
|
| - validate: function () {
|
| + validate: function() {
|
| return this.inputElement.validate();
|
| },
|
|
|
| + /**
|
| + * Restores the cursor to its original position after updating the value.
|
| + * @param {string} newValue The value that should be saved.
|
| + */
|
| + updateValueAndPreserveCaret: function(newValue) {
|
| + // Not all elements might have selection, and even if they have the
|
| + // right properties, accessing them might throw an exception (like for
|
| + // <input type=number>)
|
| + try {
|
| + var start = this.inputElement.selectionStart;
|
| + this.value = newValue;
|
| +
|
| + // The cursor automatically jumps to the end after re-setting the value,
|
| + // so restore it to its original position.
|
| + this.inputElement.selectionStart = start;
|
| + this.inputElement.selectionEnd = start;
|
| + } catch (e) {
|
| + // Just set the value and give up on the caret.
|
| + this.value = newValue;
|
| + }
|
| + },
|
| +
|
| _computeAlwaysFloatLabel: function(alwaysFloatLabel, placeholder) {
|
| return placeholder || alwaysFloatLabel;
|
| },
|
|
|