OLD | NEW |
(Empty) | |
| 1 <!-- |
| 2 @license |
| 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 |
| 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 |
| 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 |
| 9 --> |
| 10 |
| 11 <!doctype html> |
| 12 <html> |
| 13 <head> |
| 14 |
| 15 <title>avg worst case</title> |
| 16 |
| 17 <meta charset="utf-8"> |
| 18 <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-
scale=1, user-scalable=yes"> |
| 19 <meta name="mobile-web-app-capable" content="yes"> |
| 20 <meta name="apple-mobile-web-app-capable" content="yes"> |
| 21 |
| 22 <script src="../../../webcomponentsjs/webcomponents-lite.js"></script> |
| 23 |
| 24 <link rel="import" href="../../../polymer/polymer.html"> |
| 25 <link rel="import" href="../../../paper-styles/paper-styles.html"> |
| 26 <link rel="import" href="../../iron-list.html"> |
| 27 |
| 28 <style is="custom-style"> |
| 29 |
| 30 iron-list { |
| 31 width: 500px; |
| 32 height: 400px; |
| 33 float: left; |
| 34 margin: 10px; |
| 35 } |
| 36 |
| 37 .item { |
| 38 background-color: green; |
| 39 border-bottom: 1px solid white; |
| 40 } |
| 41 |
| 42 </style> |
| 43 |
| 44 </head> |
| 45 <body class="fullbleed" unresolved> |
| 46 |
| 47 <template is="dom-bind"> |
| 48 |
| 49 <h1>The physical avarage is not useful in this situations</h1> |
| 50 <p>The list is correct if it can render all the items without empty spaces.<
/p> |
| 51 <iron-list id="list" items="[791, 671]" as="item" style="width: 300px; heigh
t: 300px;"> |
| 52 <template> |
| 53 <div class="item" style$="[[_getStyle(item)]]"><span>[[index]]</span> he
ight: <span>[[item]]</span> |
| 54 </div> |
| 55 </template> |
| 56 </iron-list> |
| 57 |
| 58 <iron-list id="list2" items="[791, 671]" as="item" style="width: 710px; heig
ht: 453px;"> |
| 59 <template> |
| 60 <div class="item" style$="[[_getStyle(item)]]"><span>[[index]]</span> he
ight: <span>[[item]]</span> |
| 61 </div> |
| 62 </template> |
| 63 </iron-list> |
| 64 |
| 65 <iron-list items="[512, 256, 128, 64, 16, 16, 16, 16, 16, 16, 8, 4]" as="ite
m" style="height: 256px;"> |
| 66 <template> |
| 67 <div class="item" style$="[[_getStyle(item)]]"><span>[[index]]</span> he
ight: <span>[[item]]</span> |
| 68 </div> |
| 69 </template> |
| 70 </iron-list> |
| 71 </template> |
| 72 |
| 73 <script> |
| 74 HTMLImports.whenReady(function() { |
| 75 document.querySelector('template[is=dom-bind]')._getStyle = function(item)
{ |
| 76 return 'height:' + item + 'px; '; |
| 77 }; |
| 78 |
| 79 setTimeout(function() { |
| 80 document.querySelector('#list').push('items', 251, 191, 151, 191, 51, 51
, 51); |
| 81 }, 100); |
| 82 |
| 83 setTimeout(function() { |
| 84 document.querySelector('#list2').push('items', 251, 191, 151, 191, 51, 5
1, 51); |
| 85 }, 300); |
| 86 }); |
| 87 </script> |
| 88 </body> |
| 89 </html> |
OLD | NEW |