Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate

Issue 1403683002: Fixed to allow only HtmlElement in registerElement (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/html/html.status ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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;
361 var locationUri = classMirror.location.sourceUri.toString(); 362 var locationUri = classMirror.location.sourceUri.toString();
362 if (locationUri == 'dart:html' || locationUri == 'dart:svg') { 363 if (!isHtmlElement && (locationUri == 'dart:html' || locationUri == 'dart:sv g')) {
363 throw new DomException.jsInterop("HierarchyRequestError: Cannot register a n existing dart:html or dart:svg type."); 364 throw new DomException.jsInterop("HierarchyRequestError: Cannot register a n existing dart:html or dart:svg type.");
364 } 365 }
365 366
366 if (classMirror.isAbstract) { 367 if (classMirror.isAbstract) {
367 throw new DomException.jsInterop("HierarchyRequestError: Cannot register a n abstract class."); 368 throw new DomException.jsInterop("HierarchyRequestError: Cannot register a n abstract class.");
368 } 369 }
369 370
370 var jsClassName = _getJSClassName(classMirror); 371 var jsClassName = _getJSClassName(classMirror);
371 if (jsClassName == null) { 372 if (jsClassName == null) {
372 // Only components derived from HTML* can be extended. 373 // Only components derived from HTML* can be extended.
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 /// parameter must be provided. 498 /// parameter must be provided.
498 @Experimental() 499 @Experimental()
499 ElementUpgrader createElementUpgrader(Type type, {String extendsTag}) { 500 ElementUpgrader createElementUpgrader(Type type, {String extendsTag}) {
500 $if DART2JS 501 $if DART2JS
501 return new _JSElementUpgrader(this, type, extendsTag); 502 return new _JSElementUpgrader(this, type, extendsTag);
502 $else 503 $else
503 return new _VMElementUpgrader(this, type, extendsTag); 504 return new _VMElementUpgrader(this, type, extendsTag);
504 $endif 505 $endif
505 } 506 }
506 } 507 }
OLDNEW
« no previous file with comments | « tests/html/html.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698