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

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

Issue 1857343002: Fix registerElement for HTMLElement prototype should not change it's m_type (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix registerElement for custom elements Created 4 years, 8 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 | « tools/dom/scripts/generate_blink_file.py ('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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 * This custom element can also be instantiated via HTML using the syntax 355 * This custom element can also be instantiated via HTML using the syntax
356 * `<input is="x-bar"></input>` 356 * `<input is="x-bar"></input>`
357 * 357 *
358 */ 358 */
359 void registerElement(String tag, Type customElementClass, 359 void registerElement(String tag, Type customElementClass,
360 {String extendsTag}) { 360 {String extendsTag}) {
361 $if DART2JS 361 $if DART2JS
362 _registerCustomElement(JS('', 'window'), this, tag, customElementClass, 362 _registerCustomElement(JS('', 'window'), this, tag, customElementClass,
363 extendsTag); 363 extendsTag);
364 $else 364 $else
365 // Hack to setup an interceptor for HTMLElement so it isn't changed when a c ustom element is created.
366 var jsHTMLElementPrototype = js.JsNative.getProperty(js.JsNative.getProperty (js.context, 'HTMLElement'),'prototype');
367 _blink.Blink_Utils.defineInterceptor(jsHTMLElementPrototype, HtmlElement.ins tanceRuntimeType);
368
365 // Figure out which DOM class is being extended from the user's Dart class. 369 // Figure out which DOM class is being extended from the user's Dart class.
366 var classMirror = reflectClass(customElementClass); 370 var classMirror = reflectClass(customElementClass);
367 371
368 var locationUri = classMirror.location.sourceUri.toString(); 372 var locationUri = classMirror.location.sourceUri.toString();
369 if (locationUri == 'dart:html' || locationUri == 'dart:svg') { 373 if (locationUri == 'dart:html' || locationUri == 'dart:svg') {
370 throw new DomException.jsInterop("HierarchyRequestError: Cannot register a n existing dart:html or dart:svg type."); 374 throw new DomException.jsInterop("HierarchyRequestError: Cannot register a n existing dart:html or dart:svg type.");
371 } 375 }
372 376
373 if (classMirror.isAbstract) { 377 if (classMirror.isAbstract) {
374 throw new DomException.jsInterop("HierarchyRequestError: Cannot register a n abstract class."); 378 throw new DomException.jsInterop("HierarchyRequestError: Cannot register a n abstract class.");
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 /// parameter must be provided. 525 /// parameter must be provided.
522 @Experimental() 526 @Experimental()
523 ElementUpgrader createElementUpgrader(Type type, {String extendsTag}) { 527 ElementUpgrader createElementUpgrader(Type type, {String extendsTag}) {
524 $if DART2JS 528 $if DART2JS
525 return new _JSElementUpgrader(this, type, extendsTag); 529 return new _JSElementUpgrader(this, type, extendsTag);
526 $else 530 $else
527 return new _VMElementUpgrader(this, type, extendsTag); 531 return new _VMElementUpgrader(this, type, extendsTag);
528 $endif 532 $endif
529 } 533 }
530 } 534 }
OLDNEW
« no previous file with comments | « tools/dom/scripts/generate_blink_file.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698