| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 | 125 |
| 126 JS('void', '#.register(#, #)', document, tag, options); | 126 JS('void', '#.register(#, #)', document, tag, options); |
| 127 } | 127 } |
| 128 | 128 |
| 129 //// Called by Element.created to do validation & initialization. | 129 //// Called by Element.created to do validation & initialization. |
| 130 void _initializeCustomElement(Element e) { | 130 void _initializeCustomElement(Element e) { |
| 131 // TODO(blois): Add validation that this is only in response to an upgrade. | 131 // TODO(blois): Add validation that this is only in response to an upgrade. |
| 132 } | 132 } |
| OLD | NEW |