| 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"> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 ----------------|-------------|---------- | 29 ----------------|-------------|---------- |
| 30 `--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 | `{}` | 31 `--iron-autogrow-textarea-placeholder` | Mixin applied to the textarea placehold
er | `{}` |
| 32 | 32 |
| 33 @group Iron Elements | 33 @group Iron Elements |
| 34 @hero hero.svg | 34 @hero hero.svg |
| 35 @demo demo/index.html | 35 @demo demo/index.html |
| 36 --> | 36 --> |
| 37 | 37 |
| 38 </head><body><dom-module id="iron-autogrow-textarea"> | 38 </head><body><dom-module id="iron-autogrow-textarea"> |
| 39 <template> |
| 40 <style> |
| 41 :host { |
| 42 display: inline-block; |
| 43 position: relative; |
| 44 width: 400px; |
| 45 border: 1px solid; |
| 46 padding: 2px; |
| 47 -moz-appearance: textarea; |
| 48 -webkit-appearance: textarea; |
| 49 overflow: hidden; |
| 50 } |
| 39 | 51 |
| 40 <style> | 52 .mirror-text { |
| 41 :host { | 53 visibility: hidden; |
| 42 display: inline-block; | 54 word-wrap: break-word; |
| 43 position: relative; | 55 } |
| 44 width: 400px; | |
| 45 border: 1px solid; | |
| 46 padding: 2px; | |
| 47 -moz-appearance: textarea; | |
| 48 -webkit-appearance: textarea; | |
| 49 overflow: hidden; | |
| 50 } | |
| 51 | 56 |
| 52 .mirror-text { | 57 .fit { |
| 53 visibility: hidden; | 58 @apply(--layout-fit); |
| 54 word-wrap: break-word; | 59 } |
| 55 } | |
| 56 | 60 |
| 57 .fit { | 61 textarea { |
| 58 @apply(--layout-fit); | 62 position: relative; |
| 59 } | 63 outline: none; |
| 64 border: none; |
| 65 resize: none; |
| 66 background: inherit; |
| 67 color: inherit; |
| 68 /* see comments in template */ |
| 69 width: 100%; |
| 70 height: 100%; |
| 71 font-size: inherit; |
| 72 font-family: inherit; |
| 73 line-height: inherit; |
| 74 text-align: inherit; |
| 75 @apply(--iron-autogrow-textarea); |
| 76 } |
| 60 | 77 |
| 61 textarea { | 78 ::content textarea:invalid { |
| 62 position: relative; | 79 box-shadow: none; |
| 63 outline: none; | 80 } |
| 64 border: none; | |
| 65 resize: none; | |
| 66 background: inherit; | |
| 67 color: inherit; | |
| 68 /* see comments in template */ | |
| 69 width: 100%; | |
| 70 height: 100%; | |
| 71 font-size: inherit; | |
| 72 font-family: inherit; | |
| 73 line-height: inherit; | |
| 74 text-align: inherit; | |
| 75 @apply(--iron-autogrow-textarea); | |
| 76 } | |
| 77 | 81 |
| 78 ::content textarea:invalid { | 82 textarea::-webkit-input-placeholder { |
| 79 box-shadow: none; | 83 @apply(--iron-autogrow-textarea-placeholder); |
| 80 } | 84 } |
| 81 | 85 |
| 82 textarea::-webkit-input-placeholder { | 86 textarea:-moz-placeholder { |
| 83 @apply(--iron-autogrow-textarea-placeholder); | 87 @apply(--iron-autogrow-textarea-placeholder); |
| 84 } | 88 } |
| 85 | 89 |
| 86 textarea:-moz-placeholder { | 90 textarea::-moz-placeholder { |
| 87 @apply(--iron-autogrow-textarea-placeholder); | 91 @apply(--iron-autogrow-textarea-placeholder); |
| 88 } | 92 } |
| 89 | 93 |
| 90 textarea::-moz-placeholder { | 94 textarea:-ms-input-placeholder { |
| 91 @apply(--iron-autogrow-textarea-placeholder); | 95 @apply(--iron-autogrow-textarea-placeholder); |
| 92 } | 96 } |
| 97 </style> |
| 93 | 98 |
| 94 textarea:-ms-input-placeholder { | |
| 95 @apply(--iron-autogrow-textarea-placeholder); | |
| 96 } | |
| 97 </style> | |
| 98 <template> | |
| 99 <!-- the mirror sizes the input/textarea so it grows with typing --> | 99 <!-- the mirror sizes the input/textarea so it grows with typing --> |
| 100 <!-- 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
--> |
| 101 <div id="mirror" class="mirror-text" aria-hidden="true"> </div> | 101 <div id="mirror" class="mirror-text" aria-hidden="true"> </div> |
| 102 | 102 |
| 103 <!-- 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 --> |
| 104 <div class="textarea-container fit"> | 104 <div class="textarea-container fit"> |
| 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> | 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> |
| 106 </div> | 106 </div> |
| 107 </template> | 107 </template> |
| 108 </dom-module> | 108 </dom-module> |
| 109 | 109 |
| 110 <script src="iron-autogrow-textarea-extracted.js"></script></body></html> | 110 <script src="iron-autogrow-textarea-extracted.js"></script></body></html> |
| OLD | NEW |