| 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 --><html><head><link rel="import" href="../polymer/polymer.html"> | 9 --><html><head><link rel="import" href="../polymer/polymer.html"> |
| 10 <link rel="import" href="../iron-behaviors/iron-control-state.html"> | 10 <link rel="import" href="../iron-behaviors/iron-control-state.html"> |
| 11 <link rel="import" href="../iron-flex-layout/iron-flex-layout.html"> | 11 <link rel="import" href="../iron-flex-layout/iron-flex-layout.html"> |
| 12 <link rel="import" href="../iron-validatable-behavior/iron-validatable-behavior.
html"> | 12 <link rel="import" href="../iron-validatable-behavior/iron-validatable-behavior.
html"> |
| 13 <link rel="import" href="../iron-form-element-behavior/iron-form-element-behavio
r.html"> | 13 <link rel="import" href="../iron-form-element-behavior/iron-form-element-behavio
r.html"> |
| 14 | 14 |
| 15 <!-- | 15 <!-- |
| 16 `iron-autogrow-textarea` is an element containing a textarea that grows in heigh
t as more | 16 `iron-autogrow-textarea` is an element containing a textarea that grows in heigh
t as more |
| 17 lines of input are entered. Unless an explicit height or the `maxRows` property
is set, it will | 17 lines of input are entered. Unless an explicit height or the `maxRows` property
is set, it will |
| 18 never scroll. | 18 never scroll. |
| 19 | 19 |
| 20 Example: | 20 Example: |
| 21 | 21 |
| 22 <iron-autogrow-textarea></iron-autogrow-textarea> | 22 <iron-autogrow-textarea></iron-autogrow-textarea> |
| 23 | 23 |
| 24 Because the `textarea`'s `value` property is not observable, you should use | |
| 25 this element's `bind-value` instead for imperative updates. | |
| 26 | |
| 27 ### Styling | 24 ### Styling |
| 28 | 25 |
| 29 The following custom properties and mixins are available for styling: | 26 The following custom properties and mixins are available for styling: |
| 30 | 27 |
| 31 Custom property | Description | Default | 28 Custom property | Description | Default |
| 32 ----------------|-------------|---------- | 29 ----------------|-------------|---------- |
| 33 `--iron-autogrow-textarea` | Mixin applied to the textarea | `{}` | 30 `--iron-autogrow-textarea` | Mixin applied to the textarea | `{}` |
| 31 `--iron-autogrow-textarea-placeholder` | Mixin applied to the textarea placehold
er | `{}` |
| 34 | 32 |
| 35 @group Iron Elements | 33 @group Iron Elements |
| 36 @hero hero.svg | 34 @hero hero.svg |
| 37 @demo demo/index.html | 35 @demo demo/index.html |
| 38 --> | 36 --> |
| 39 | 37 |
| 40 </head><body><dom-module id="iron-autogrow-textarea"> | 38 </head><body><dom-module id="iron-autogrow-textarea"> |
| 41 | 39 |
| 42 <style> | 40 <style> |
| 43 :host { | 41 :host { |
| 44 display: inline-block; | 42 display: inline-block; |
| 45 position: relative; | 43 position: relative; |
| 46 width: 400px; | 44 width: 400px; |
| 47 border: 1px solid; | 45 border: 1px solid; |
| 48 padding: 2px; | 46 padding: 2px; |
| 49 -moz-appearance: textarea; | 47 -moz-appearance: textarea; |
| 50 -webkit-appearance: textarea; | 48 -webkit-appearance: textarea; |
| 49 overflow: hidden; |
| 51 } | 50 } |
| 52 | 51 |
| 53 .mirror-text { | 52 .mirror-text { |
| 54 visibility: hidden; | 53 visibility: hidden; |
| 55 word-wrap: break-word; | 54 word-wrap: break-word; |
| 56 } | 55 } |
| 57 | 56 |
| 58 .fit { | 57 .fit { |
| 59 @apply(--layout-fit); | 58 @apply(--layout-fit); |
| 60 } | 59 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 73 font-family: inherit; | 72 font-family: inherit; |
| 74 line-height: inherit; | 73 line-height: inherit; |
| 75 text-align: inherit; | 74 text-align: inherit; |
| 76 @apply(--iron-autogrow-textarea); | 75 @apply(--iron-autogrow-textarea); |
| 77 } | 76 } |
| 78 | 77 |
| 79 ::content textarea:invalid { | 78 ::content textarea:invalid { |
| 80 box-shadow: none; | 79 box-shadow: none; |
| 81 } | 80 } |
| 82 | 81 |
| 82 textarea::-webkit-input-placeholder { |
| 83 @apply(--iron-autogrow-textarea-placeholder); |
| 84 } |
| 85 |
| 86 textarea:-moz-placeholder { |
| 87 @apply(--iron-autogrow-textarea-placeholder); |
| 88 } |
| 89 |
| 90 textarea::-moz-placeholder { |
| 91 @apply(--iron-autogrow-textarea-placeholder); |
| 92 } |
| 93 |
| 94 textarea:-ms-input-placeholder { |
| 95 @apply(--iron-autogrow-textarea-placeholder); |
| 96 } |
| 83 </style> | 97 </style> |
| 84 <template> | 98 <template> |
| 85 <!-- the mirror sizes the input/textarea so it grows with typing --> | 99 <!-- the mirror sizes the input/textarea so it grows with typing --> |
| 86 <!-- use   instead of to allow this element to be used in XHTML
--> | 100 <!-- use   instead of to allow this element to be used in XHTML
--> |
| 87 <div id="mirror" class="mirror-text" aria-hidden="true"> </div> | 101 <div id="mirror" class="mirror-text" aria-hidden="true"> </div> |
| 88 | 102 |
| 89 <!-- size the input/textarea with a div, because the textarea has intrinsic
size in ff --> | 103 <!-- size the input/textarea with a div, because the textarea has intrinsic
size in ff --> |
| 90 <div class="textarea-container fit"> | 104 <div class="textarea-container fit"> |
| 91 <textarea id="textarea" autocomplete$="[[autocomplete]]" autofocus$="[[aut
ofocus]]" inputmode$="[[inputmode]]" placeholder$="[[placeholder]]" readonly$="[
[readonly]]" required$="[[required]]" disabled$="[[disabled]]" rows$="[[rows]]"
maxlength$="[[maxlength]]"></textarea> | 105 <textarea id="textarea" name$="[[name]]" autocomplete$="[[autocomplete]]"
autofocus$="[[autofocus]]" inputmode$="[[inputmode]]" placeholder$="[[placeholde
r]]" readonly$="[[readonly]]" required$="[[required]]" disabled$="[[disabled]]"
rows$="[[rows]]" maxlength$="[[maxlength]]"></textarea> |
| 92 </div> | 106 </div> |
| 93 </template> | 107 </template> |
| 94 </dom-module> | 108 </dom-module> |
| 95 | 109 |
| 96 <script src="iron-autogrow-textarea-extracted.js"></script></body></html> | 110 <script src="iron-autogrow-textarea-extracted.js"></script></body></html> |
| OLD | NEW |