OLD | NEW |
1 <!-- | 1 <!-- |
2 // Copyright 2015 The Chromium Authors. All rights reserved. | 2 // Copyright 2015 The Chromium Authors. All rights reserved. |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 --> | 5 --> |
6 <import src="/sky/framework/sky-element.sky" /> | 6 <import src="/sky/framework/sky-element.sky" /> |
7 <import src="/sky/framework/sky-scrollable.sky" /> | 7 <import src="/sky/framework/sky-scrollable.sky" /> |
8 <import src="../data/cities.sky" as="cities" /> | 8 <import src="../data/cities.sky" as="cities" /> |
9 | 9 |
10 <sky-element name="example-scrollable"> | 10 <sky-element> |
11 <template> | 11 <template> |
12 <style> | 12 <style> |
13 sky-scrollable { | 13 sky-scrollable { |
14 margin: 20px; | 14 margin: 20px; |
15 height: 400px; | 15 height: 400px; |
16 border: 2px solid blue; | 16 border: 2px solid blue; |
17 } | 17 } |
18 </style> | 18 </style> |
19 <sky-scrollable /> | 19 <sky-scrollable /> |
20 </template> | 20 </template> |
21 <script> | 21 <script> |
22 import "dart:sky"; | 22 import "dart:sky"; |
23 | 23 |
24 @Tagname('example-scrollable') | 24 @Tagname('scrolling') |
25 class ExampleScrollable extends SkyElement { | 25 class Scrolling extends SkyElement { |
26 void shadowRootReady() { | 26 void shadowRootReady() { |
27 Element parent = shadowRoot.querySelector('sky-scrollable'); | 27 Element parent = shadowRoot.querySelector('sky-scrollable'); |
28 for (Map city in cities.kData.getRange(0, 300)) { | 28 for (Map city in cities.kData.getRange(0, 300)) { |
29 Element div = document.createElement('div'); | 29 Element div = document.createElement('div'); |
30 div.setChild(new Text(city['name'])); | 30 div.setChild(new Text(city['name'])); |
31 parent.appendChild(div); | 31 parent.appendChild(div); |
32 } | 32 } |
33 } | 33 } |
34 } | 34 } |
35 | 35 |
36 _init(script) => register(script, ExampleScrollable); | 36 _init(script) => register(script, Scrolling); |
37 </script> | 37 </script> |
38 </sky-element> | 38 </sky-element> |
OLD | NEW |