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

Side by Side Diff: tools/dom/src/dart2js_CustomElementSupport.dart

Issue 27063005: Removing dart2js's extends tag inference (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
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 23 matching lines...) Expand all
34 _makeCallbackMethod3(callback) { 34 _makeCallbackMethod3(callback) {
35 return JS('', 35 return JS('',
36 '''((function(invokeCallback) { 36 '''((function(invokeCallback) {
37 return function(arg1, arg2, arg3) { 37 return function(arg1, arg2, arg3) {
38 return invokeCallback(this, arg1, arg2, arg3); 38 return invokeCallback(this, arg1, arg2, arg3);
39 }; 39 };
40 })(#))''', 40 })(#))''',
41 convertDartClosureToJS(callback, 4)); 41 convertDartClosureToJS(callback, 4));
42 } 42 }
43 43
44 const _typeNameToTag = const {
45 'HTMLAnchorElement': 'a',
46 'HTMLAudioElement': 'audio',
47 'HTMLButtonElement': 'button',
48 'HTMLCanvasElement': 'canvas',
49 'HTMLDivElement': 'div',
50 'HTMLImageElement': 'img',
51 'HTMLInputElement': 'input',
52 'HTMLLIElement': 'li',
53 'HTMLLabelElement': 'label',
54 'HTMLMenuElement': 'menu',
55 'HTMLMeterElement': 'meter',
56 'HTMLOListElement': 'ol',
57 'HTMLOptionElement': 'option',
58 'HTMLOutputElement': 'output',
59 'HTMLParagraphElement': 'p',
60 'HTMLPreElement': 'pre',
61 'HTMLProgressElement': 'progress',
62 'HTMLSelectElement': 'select',
63 'HTMLSpanElement': 'span',
64 'HTMLUListElement': 'ul',
65 'HTMLVideoElement': 'video',
66 };
67
68 void _registerCustomElement(context, document, String tag, Type type, 44 void _registerCustomElement(context, document, String tag, Type type,
69 String extendsTagName) { 45 String extendsTagName) {
70 // Function follows the same pattern as the following JavaScript code for 46 // Function follows the same pattern as the following JavaScript code for
71 // registering a custom element. 47 // registering a custom element.
72 // 48 //
73 // var proto = Object.create(HTMLElement.prototype, { 49 // var proto = Object.create(HTMLElement.prototype, {
74 // createdCallback: { 50 // createdCallback: {
75 // value: function() { 51 // value: function() {
76 // window.console.log('here'); 52 // window.console.log('here');
77 // } 53 // }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 102
127 var interceptor = JS('=Object', '#.prototype', interceptorClass); 103 var interceptor = JS('=Object', '#.prototype', interceptorClass);
128 104
129 setNativeSubclassDispatchRecord(proto, interceptor); 105 setNativeSubclassDispatchRecord(proto, interceptor);
130 106
131 var options = JS('=Object', '{prototype: #}', proto); 107 var options = JS('=Object', '{prototype: #}', proto);
132 108
133 if (baseClassName != 'HTMLElement') { 109 if (baseClassName != 'HTMLElement') {
134 if (extendsTagName != null) { 110 if (extendsTagName != null) {
135 JS('=Object', '#.extends = #', options, extendsTagName); 111 JS('=Object', '#.extends = #', options, extendsTagName);
136 } else if (_typeNameToTag.containsKey(baseClassName)) {
137 JS('=Object', '#.extends = #', options, _typeNameToTag[baseClassName]);
138 } 112 }
139 } 113 }
140 114
141 JS('void', '#.register(#, #)', document, tag, options); 115 JS('void', '#.register(#, #)', document, tag, options);
142 } 116 }
143 117
144 //// Called by Element.created to do validation & initialization. 118 //// Called by Element.created to do validation & initialization.
145 void _initializeCustomElement(Element e) { 119 void _initializeCustomElement(Element e) {
146 // 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.
147 } 121 }
OLDNEW
« sdk/lib/html/dartium/html_dartium.dart ('K') | « sdk/lib/html/dartium/html_dartium.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698