| 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 <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  Loading... | 
|  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> | 
| OLD | NEW |