OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // WARNING: Do not edit - generated code. | 5 // WARNING: Do not edit - generated code. |
6 | 6 |
7 part of $LIBRARYNAME; | 7 part of $LIBRARYNAME; |
8 | 8 |
9 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
{ | 9 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
{ |
10 $!MEMBERS | 10 $!MEMBERS |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 {String extendsTag}) { | 351 {String extendsTag}) { |
352 $if DART2JS | 352 $if DART2JS |
353 _registerCustomElement(JS('', 'window'), this, tag, customElementClass, | 353 _registerCustomElement(JS('', 'window'), this, tag, customElementClass, |
354 extendsTag); | 354 extendsTag); |
355 $else | 355 $else |
356 // TODO(terry): Need to handle the extendsTag. | 356 // TODO(terry): Need to handle the extendsTag. |
357 | 357 |
358 // Figure out which DOM class is being extended from the user's Dart class. | 358 // Figure out which DOM class is being extended from the user's Dart class. |
359 var classMirror = reflectClass(customElementClass); | 359 var classMirror = reflectClass(customElementClass); |
360 | 360 |
361 var isHtmlElement = classMirror.qualifiedName == #dart.dom.html.HtmlElement; | |
362 var locationUri = classMirror.location.sourceUri.toString(); | 361 var locationUri = classMirror.location.sourceUri.toString(); |
363 if (!isHtmlElement && (locationUri == 'dart:html' || locationUri == 'dart:sv
g')) { | 362 if (locationUri == 'dart:html' || locationUri == 'dart:svg') { |
364 throw new DomException.jsInterop("HierarchyRequestError: Cannot register a
n existing dart:html or dart:svg type."); | 363 throw new DomException.jsInterop("HierarchyRequestError: Cannot register a
n existing dart:html or dart:svg type."); |
365 } | 364 } |
366 | 365 |
367 if (classMirror.isAbstract) { | 366 if (classMirror.isAbstract) { |
368 throw new DomException.jsInterop("HierarchyRequestError: Cannot register a
n abstract class."); | 367 throw new DomException.jsInterop("HierarchyRequestError: Cannot register a
n abstract class."); |
369 } | 368 } |
370 | 369 |
371 var jsClassName = _getJSClassName(classMirror); | 370 var jsClassName = _getJSClassName(classMirror); |
372 if (jsClassName == null) { | 371 if (jsClassName == null) { |
373 // Only components derived from HTML* can be extended. | 372 // Only components derived from HTML* can be extended. |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 /// parameter must be provided. | 497 /// parameter must be provided. |
499 @Experimental() | 498 @Experimental() |
500 ElementUpgrader createElementUpgrader(Type type, {String extendsTag}) { | 499 ElementUpgrader createElementUpgrader(Type type, {String extendsTag}) { |
501 $if DART2JS | 500 $if DART2JS |
502 return new _JSElementUpgrader(this, type, extendsTag); | 501 return new _JSElementUpgrader(this, type, extendsTag); |
503 $else | 502 $else |
504 return new _VMElementUpgrader(this, type, extendsTag); | 503 return new _VMElementUpgrader(this, type, extendsTag); |
505 $endif | 504 $endif |
506 } | 505 } |
507 } | 506 } |
OLD | NEW |