| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 @license | 2 @license |
| 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 7 Code distributed by Google as part of the polymer project is also | 7 Code distributed by Google as part of the polymer project is also |
| 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 9 --> | 9 --> |
| 10 | 10 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 box-shadow: none; | 66 box-shadow: none; |
| 67 } | 67 } |
| 68 | 68 |
| 69 </style> | 69 </style> |
| 70 <template> | 70 <template> |
| 71 <!-- the mirror sizes the input/textarea so it grows with typing --> | 71 <!-- the mirror sizes the input/textarea so it grows with typing --> |
| 72 <div id="mirror" class="mirror-text" aria-hidden="true"> </div> | 72 <div id="mirror" class="mirror-text" aria-hidden="true"> </div> |
| 73 | 73 |
| 74 <!-- size the input/textarea with a div, because the textarea has intrinsic
size in ff --> | 74 <!-- size the input/textarea with a div, because the textarea has intrinsic
size in ff --> |
| 75 <div class="textarea-container fit"> | 75 <div class="textarea-container fit"> |
| 76 <textarea id="textarea" required$="[[required]]" rows$="[[rows]]" maxlengt
h$="[[maxlength]]"></textarea> | 76 <textarea id="textarea" |
| 77 autocomplete$="[[autocomplete]]" |
| 78 autofocus$="[[autofocus]]" |
| 79 inputmode$="[[inputmode]]" |
| 80 name$="[[name]]" |
| 81 placeholder$="[[placeholder]]" |
| 82 readonly$="[[readonly]]" |
| 83 required$="[[required]]" |
| 84 rows$="[[rows]]" |
| 85 maxlength$="[[maxlength]]"></textarea> |
| 77 </div> | 86 </div> |
| 78 </template> | 87 </template> |
| 79 | 88 |
| 80 <script> | 89 <script> |
| 81 | 90 |
| 82 Polymer({ | 91 Polymer({ |
| 83 | 92 |
| 84 is: 'iron-autogrow-textarea', | 93 is: 'iron-autogrow-textarea', |
| 85 | 94 |
| 86 behaviors: [ | 95 behaviors: [ |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 * @type number | 127 * @type number |
| 119 * @default 0 | 128 * @default 0 |
| 120 */ | 129 */ |
| 121 maxRows: { | 130 maxRows: { |
| 122 type: Number, | 131 type: Number, |
| 123 value: 0, | 132 value: 0, |
| 124 observer: '_updateCached' | 133 observer: '_updateCached' |
| 125 }, | 134 }, |
| 126 | 135 |
| 127 /** | 136 /** |
| 137 * Bound to the textarea's `autocomplete` attribute. |
| 138 */ |
| 139 autocomplete: { |
| 140 type: String, |
| 141 value: 'off' |
| 142 }, |
| 143 |
| 144 /** |
| 145 * Bound to the textarea's `autofocus` attribute. |
| 146 */ |
| 147 autofocus: { |
| 148 type: String, |
| 149 value: 'off' |
| 150 }, |
| 151 |
| 152 /** |
| 153 * Bound to the textarea's `inputmode` attribute. |
| 154 */ |
| 155 inputmode: { |
| 156 type: String |
| 157 }, |
| 158 |
| 159 /** |
| 160 * Bound to the textarea's `name` attribute. |
| 161 */ |
| 162 name: { |
| 163 type: String |
| 164 }, |
| 165 |
| 166 /** |
| 167 * Bound to the textarea's `placeholder` attribute. |
| 168 */ |
| 169 placeholder: { |
| 170 type: String |
| 171 }, |
| 172 |
| 173 /** |
| 174 * Bound to the textarea's `readonly` attribute. |
| 175 */ |
| 176 readonly: { |
| 177 type: String |
| 178 }, |
| 179 |
| 180 /** |
| 128 * Set to true to mark the textarea as required. | 181 * Set to true to mark the textarea as required. |
| 129 */ | 182 */ |
| 130 required: { | 183 required: { |
| 131 type: Boolean | 184 type: Boolean |
| 132 }, | 185 }, |
| 133 | 186 |
| 134 /** | 187 /** |
| 135 * The maximum length of the input value. | 188 * The maximum length of the input value. |
| 136 */ | 189 */ |
| 137 maxlength: { | 190 maxlength: { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 } | 254 } |
| 202 this.tokens = (input && input.value) ? input.value.replace(/&/gm, '&')
.replace(/"/gm, '"').replace(/'/gm, ''').replace(/</gm, '<').replace
(/>/gm, '>').split('\n') : ['']; | 255 this.tokens = (input && input.value) ? input.value.replace(/&/gm, '&')
.replace(/"/gm, '"').replace(/'/gm, ''').replace(/</gm, '<').replace
(/>/gm, '>').split('\n') : ['']; |
| 203 return this._constrain(this.tokens); | 256 return this._constrain(this.tokens); |
| 204 }, | 257 }, |
| 205 | 258 |
| 206 _updateCached: function() { | 259 _updateCached: function() { |
| 207 this.$.mirror.innerHTML = this._constrain(this.tokens); | 260 this.$.mirror.innerHTML = this._constrain(this.tokens); |
| 208 } | 261 } |
| 209 }) | 262 }) |
| 210 </script> | 263 </script> |
| OLD | NEW |