| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 _callConstructor(constructor) { | 7 _callConstructor(constructor) { |
| 8 return (receiver) { | 8 return (receiver) { |
| 9 return JS('', '#(#)', constructor, receiver); | 9 return JS('', '#(#)', constructor, receiver); |
| 10 }; | 10 }; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // }); | 55 // }); |
| 56 // document.register('x-foo', { prototype: proto }); | 56 // document.register('x-foo', { prototype: proto }); |
| 57 // ... | 57 // ... |
| 58 // var e = document.createElement('x-foo'); | 58 // var e = document.createElement('x-foo'); |
| 59 | 59 |
| 60 var interceptorClass = findInterceptorConstructorForType(type); | 60 var interceptorClass = findInterceptorConstructorForType(type); |
| 61 if (interceptorClass == null) { | 61 if (interceptorClass == null) { |
| 62 throw new ArgumentError(type); | 62 throw new ArgumentError(type); |
| 63 } | 63 } |
| 64 | 64 |
| 65 var constructor = findConstructorForWebComponentType(type, 'created'); | 65 var constructor = findConstructorForNativeSubclassType(type, 'created'); |
| 66 if (constructor == null) { | 66 if (constructor == null) { |
| 67 throw new ArgumentError("$type has no constructor called 'created'"); | 67 throw new ArgumentError("$type has no constructor called 'created'"); |
| 68 } | 68 } |
| 69 | 69 |
| 70 // Workaround for 13190- use an article element to ensure that HTMLElement's | 70 // Workaround for 13190- use an article element to ensure that HTMLElement's |
| 71 // interceptor is resolved correctly. | 71 // interceptor is resolved correctly. |
| 72 getNativeInterceptor(new Element.tag('article')); | 72 getNativeInterceptor(new Element.tag('article')); |
| 73 | 73 |
| 74 String baseClassName = findDispatchTagForInterceptorClass(interceptorClass); | 74 String baseClassName = findDispatchTagForInterceptorClass(interceptorClass); |
| 75 if (baseClassName == null) { | 75 if (baseClassName == null) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 | 114 |
| 115 JS('void', '#.register(#, #)', document, tag, options); | 115 JS('void', '#.register(#, #)', document, tag, options); |
| 116 } | 116 } |
| 117 | 117 |
| 118 //// Called by Element.created to do validation & initialization. | 118 //// Called by Element.created to do validation & initialization. |
| 119 void _initializeCustomElement(Element e) { | 119 void _initializeCustomElement(Element e) { |
| 120 // TODO(blois): Add validation that this is only in response to an upgrade. | 120 // TODO(blois): Add validation that this is only in response to an upgrade. |
| 121 } | 121 } |
| OLD | NEW |