OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of dart.dom.html; | 5 part of dart.dom.html; |
6 | 6 |
7 /// Dartium ElementUpgrader implementation. | 7 /// Dartium ElementUpgrader implementation. |
8 class _VMElementUpgrader implements ElementUpgrader { | 8 class _VMElementUpgrader implements ElementUpgrader { |
9 final Type _type; | 9 final Type _type; |
10 final Type _nativeType; | 10 final Type _nativeType; |
(...skipping 13 matching lines...) Expand all Loading... |
24 'extendsTag does not match base native class'); | 24 'extendsTag does not match base native class'); |
25 } | 25 } |
26 } | 26 } |
27 } | 27 } |
28 | 28 |
29 Element upgrade(element) { | 29 Element upgrade(element) { |
30 if (element.runtimeType != js.JsObjectImpl) { | 30 if (element.runtimeType != js.JsObjectImpl) { |
31 throw new UnsupportedError('Element is incorrect type'); | 31 throw new UnsupportedError('Element is incorrect type'); |
32 } | 32 } |
33 | 33 |
| 34 // Remember Dart class to tagName for any upgrading done in wrap_jso. |
| 35 var tag = element['localName']; |
| 36 _knownCustomeElements[tag] = _type; |
| 37 |
34 return createCustomUpgrader(_nativeType, element); | 38 return createCustomUpgrader(_nativeType, element); |
35 } | 39 } |
36 } | 40 } |
37 | 41 |
38 /// Validates that the custom type is properly formed- | 42 /// Validates that the custom type is properly formed- |
39 /// | 43 /// |
40 /// * Is a user-defined class. | 44 /// * Is a user-defined class. |
41 /// * Has a created constructor with zero args. | 45 /// * Has a created constructor with zero args. |
42 /// * Derives from an Element subclass. | 46 /// * Derives from an Element subclass. |
43 /// | 47 /// |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 return nativeClass; | 89 return nativeClass; |
86 } | 90 } |
87 | 91 |
88 | 92 |
89 bool _isBuiltinType(ClassMirror cls) { | 93 bool _isBuiltinType(ClassMirror cls) { |
90 // TODO(vsm): Find a less hackish way to do this. | 94 // TODO(vsm): Find a less hackish way to do this. |
91 LibraryMirror lib = cls.owner; | 95 LibraryMirror lib = cls.owner; |
92 String libName = lib.uri.toString(); | 96 String libName = lib.uri.toString(); |
93 return libName.startsWith('dart:'); | 97 return libName.startsWith('dart:'); |
94 } | 98 } |
OLD | NEW |