Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: sky/framework/sky-element.sky

Issue 932103004: Make the stock app demo list view prettier (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/examples/stocks/stock-arrow.sky ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <script> 6 <script>
7 import "dart:mirrors"; 7 import "dart:mirrors";
8 import "dart:sky"; 8 import "dart:sky";
9 9
10 typedef dynamic _Converter(String value); 10 typedef dynamic _Converter(String value);
11 11
12 final Map<String, _Converter> _kAttributeConverters = { 12 final Map<String, _Converter> _kAttributeConverters = {
13 'boolean': (String value) { 13 'boolean': (String value) {
14 return value == 'true'; 14 return value == 'true';
15 }, 15 },
16 'number': (String value) { 16 'number': (String value) {
17 return double.parse(value); 17 try {
18 return double.parse(value);
19 } catch(_) {
20 return 0.0;
21 }
18 }, 22 },
19 'string': (String value) { 23 'string': (String value) {
20 return value == null ? '' : value; 24 return value == null ? '' : value;
21 }, 25 },
22 }; 26 };
23 27
24 class _Registration { 28 class _Registration {
25 final Element template; 29 final Element template;
26 final Map<String, _Converter> attributes = new Map(); 30 final Map<String, _Converter> attributes = new Map();
27 31
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 throw new UnsupportedError('@Tagname can only be used on descendants of SkyE lement'); 155 throw new UnsupportedError('@Tagname can only be used on descendants of SkyE lement');
152 156
153 String tagName = _getTagName(type); 157 String tagName = _getTagName(type);
154 Element template = definition.querySelector('template'); 158 Element template = definition.querySelector('template');
155 159
156 document.registerElement(tagName, type); 160 document.registerElement(tagName, type);
157 _registery[tagName] = new _Registration(template) 161 _registery[tagName] = new _Registration(template)
158 ..parseAttributeSpec(definition); 162 ..parseAttributeSpec(definition);
159 } 163 }
160 </script> 164 </script>
OLDNEW
« no previous file with comments | « sky/examples/stocks/stock-arrow.sky ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698