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

Side by Side Diff: pkg/polymer/lib/src/declaration.dart

Issue 26051002: Updating Polymer to derive from custom elements. (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 polymer; 5 part of polymer;
6 6
7 /** 7 /**
8 * **Deprecated**: use [Polymer.register] instead.
9 *
10 * Registers a [PolymerElement]. This is similar to [registerCustomElement]
11 * but it is designed to work with the `<element>` element and adds additional
12 * features.
13 */
14 @deprecated
15 void registerPolymerElement(String localName, PolymerElement create()) {
Siggi Cherem (dart-lang) 2013/10/10 22:25:51 to make the transition easier on users, consider k
Jennifer Messerly 2013/10/10 22:35:17 yay
blois 2013/10/11 22:40:12 Done. But it's deprecated right now, how long unti
Siggi Cherem (dart-lang) 2013/10/11 23:14:50 Oh, sorry, I hadn't noticed it was already marked
16 Polymer._registerClassMirror(localName, reflect(create()).type);
17 }
18
19 /**
20 * **Warning**: this class is experiental and subject to change. 8 * **Warning**: this class is experiental and subject to change.
21 * 9 *
22 * The implementation for the `polymer-element` element. 10 * The implementation for the `polymer-element` element.
23 * 11 *
24 * Normally you do not need to use this class directly, see [PolymerElement]. 12 * Normally you do not need to use this class directly, see [PolymerElement].
25 */ 13 */
26 class PolymerDeclaration extends CustomElement { 14 class PolymerDeclaration extends HtmlElement {
15 static const _TAG = 'polymer-element';
16
17 factory PolymerDeclaration() => new Element.tag(_TAG);
27 // Fully ported from revision: 18 // Fully ported from revision:
28 // https://github.com/Polymer/polymer/blob/4dc481c11505991a7c43228d3797d28f212 67779 19 // https://github.com/Polymer/polymer/blob/4dc481c11505991a7c43228d3797d28f212 67779
29 // 20 //
30 // src/declaration/attributes.js 21 // src/declaration/attributes.js
31 // src/declaration/events.js 22 // src/declaration/events.js
32 // src/declaration/polymer-element.js 23 // src/declaration/polymer-element.js
33 // src/declaration/properties.js 24 // src/declaration/properties.js
34 // src/declaration/prototype.js (note: most code not needed in Dart) 25 // src/declaration/prototype.js (note: most code not needed in Dart)
35 // src/declaration/styles.js 26 // src/declaration/styles.js
36 // 27 //
37 // Not yet ported: 28 // Not yet ported:
38 // src/declaration/path.js - blocked on HTMLImports.getDocumentUrl 29 // src/declaration/path.js - blocked on HTMLImports.getDocumentUrl
39 30
40 // TODO(jmesserly): these should be Type not ClassMirror. But we can't get 31 // TODO(jmesserly): these should be Type not ClassMirror. But we can't get
Jennifer Messerly 2013/10/10 22:35:17 remove TODO :)
blois 2013/10/11 22:40:12 Done.
41 // from ClassMirror to Type yet in dart2js, so we use ClassMirror for now. 32 // from ClassMirror to Type yet in dart2js, so we use ClassMirror for now.
42 // See https://code.google.com/p/dart/issues/detail?id=12607 33 // See https://code.google.com/p/dart/issues/detail?id=12607
Siggi Cherem (dart-lang) 2013/10/10 22:25:51 Consider removing this TODO, but add one on the ty
blois 2013/10/11 22:40:12 Done.
43 ClassMirror _type; 34 Type _type;
44 ClassMirror get type => _type; 35 Type get type => _type;
45 36
46 // TODO(jmesserly): this is a cache, because it's tricky in Dart to get from 37 // TODO(jmesserly): this is a cache, because it's tricky in Dart to get from
47 // ClassMirror -> Supertype. 38 // Type -> Supertype.
Siggi Cherem (dart-lang) 2013/10/10 22:25:51 I know this is unrelated to your change, but shoul
blois 2013/10/11 22:40:12 Is the answer that we should use mirrors once it's
48 ClassMirror _supertype; 39 Type _supertype;
49 ClassMirror get supertype => _supertype; 40 Type get supertype => _supertype;
50 41
51 // TODO(jmesserly): this is also a cache, since we can't store .element on 42 // TODO(jmesserly): this is also a cache, since we can't store .element on
52 // each level of the __proto__ like JS does. 43 // each level of the __proto__ like JS does.
53 PolymerDeclaration _super; 44 PolymerDeclaration _super;
54 PolymerDeclaration get superDeclaration => _super; 45 PolymerDeclaration get superDeclaration => _super;
55 46
56 String _name; 47 String _name;
57 String get name => _name; 48 String get name => _name;
58 49
59 /** 50 /**
(...skipping 13 matching lines...) Expand all
73 64
74 Map<String, Object> _instanceAttributes; 65 Map<String, Object> _instanceAttributes;
75 66
76 List<Element> _sheets; 67 List<Element> _sheets;
77 List<Element> get sheets => _sheets; 68 List<Element> get sheets => _sheets;
78 69
79 List<Element> _styles; 70 List<Element> _styles;
80 List<Element> get styles => _styles; 71 List<Element> get styles => _styles;
81 72
82 DocumentFragment get templateContent { 73 DocumentFragment get templateContent {
83 final template = query('template'); 74 final template = query('template');
Siggi Cherem (dart-lang) 2013/10/10 23:56:15 I was just browsing through this, should this be t
blois 2013/10/11 22:40:12 Good catch. Done.
84 return template != null ? template.content : null; 75 return template != null ? template.content : null;
85 } 76 }
86 77
87 /** Maps event names and their associated method in the element class. */ 78 /** Maps event names and their associated method in the element class. */
88 final Map<String, String> _eventDelegates = {}; 79 final Map<String, String> _eventDelegates = {};
89 80
90 /** Expected events per element node. */ 81 /** Expected events per element node. */
91 // TODO(sigmund): investigate whether we need more than 1 set of local events 82 // TODO(sigmund): investigate whether we need more than 1 set of local events
92 // per element (why does the js implementation stores 1 per template node?) 83 // per element (why does the js implementation stores 1 per template node?)
93 Expando<Set<String>> _templateDelegates; 84 Expando<Set<String>> _templateDelegates;
94 85
95 void created() { 86 PolymerDeclaration.created() : super.created() {
96 super.created();
97
98 // fetch the element name 87 // fetch the element name
99 _name = attributes['name']; 88 _name = attributes['name'];
100 // install element definition, if ready 89 // install element definition, if ready
101 registerWhenReady(); 90 registerWhenReady();
102 } 91 }
103 92
104 void registerWhenReady() { 93 void registerWhenReady() {
105 // if we have no prototype, wait 94 // if we have no prototype, wait
106 if (waitingForType(name)) { 95 if (waitingForType(name)) {
107 return; 96 return;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 // setting resource paths. e.g. 168 // setting resource paths. e.g.
180 // this.$.image.src = this.resolvePath('images/foo.png') 169 // this.$.image.src = this.resolvePath('images/foo.png')
181 // Potentially remove when spec bug is addressed. 170 // Potentially remove when spec bug is addressed.
182 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=21407 171 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=21407
183 // TODO(jmesserly): resolvePath not ported, see first comment in this class. 172 // TODO(jmesserly): resolvePath not ported, see first comment in this class.
184 173
185 // under ShadowDOMPolyfill, transforms to approximate missing CSS features 174 // under ShadowDOMPolyfill, transforms to approximate missing CSS features
186 _shimShadowDomStyling(templateContent, name); 175 _shimShadowDomStyling(templateContent, name);
187 176
188 // register our custom element 177 // register our custom element
189 registerType(name); 178 registerType(name, extendsTag: extendee);
190 179
191 // NOTE: skip in Dart because we don't have mutable global scope. 180 // NOTE: skip in Dart because we don't have mutable global scope.
192 // reference constructor in a global named by 'constructor' attribute 181 // reference constructor in a global named by 'constructor' attribute
193 // publishConstructor(); 182 // publishConstructor();
194 } 183 }
195 184
196 /** 185 /**
197 * Gets the Dart type registered for this name, and sets up declarative 186 * Gets the Dart type registered for this name, and sets up declarative
198 * features. Fills in the [type] and [supertype] fields. 187 * features. Fills in the [type] and [supertype] fields.
199 * 188 *
200 * *Note*: unlike the JavaScript version, we do not have to metaprogram the 189 * *Note*: unlike the JavaScript version, we do not have to metaprogram the
201 * prototype, which simplifies this method. 190 * prototype, which simplifies this method.
202 */ 191 */
203 void buildType(String name, String extendee) { 192 void buildType(String name, String extendee) {
204 // get our custom type 193 // get our custom type
205 _type = _getRegisteredType(name); 194 _type = _getRegisteredType(name);
206 195
207 // get basal prototype 196 // get basal prototype
208 _supertype = _getRegisteredType(extendee); 197 _supertype = _getRegisteredType(extendee);
209 if (supertype != null) _super = _getDeclaration(supertype); 198 if (supertype != null) _super = _getDeclaration(supertype);
210 199
200 var cls = reflectClass(_type);
201
211 // transcribe `attributes` declarations onto own prototype's `publish` 202 // transcribe `attributes` declarations onto own prototype's `publish`
212 publishAttributes(type, _super); 203 publishAttributes(cls, _super);
213 204
214 publishProperties(type); 205 publishProperties(type);
215 206
216 inferObservers(type); 207 inferObservers(cls);
217 208
218 // Skip the rest in Dart: 209 // Skip the rest in Dart:
219 // chain various meta-data objects to inherited versions 210 // chain various meta-data objects to inherited versions
220 // chain custom api to inherited 211 // chain custom api to inherited
221 // build side-chained lists to optimize iterations 212 // build side-chained lists to optimize iterations
222 // inherit publishing meta-data 213 // inherit publishing meta-data
223 //this.inheritAttributesObjects(prototype); 214 //this.inheritAttributesObjects(prototype);
224 //this.inheritDelegates(prototype); 215 //this.inheritDelegates(prototype);
225 // x-platform fixups 216 // x-platform fixups
226 } 217 }
227 218
228 /** Implement various declarative features. */ 219 /** Implement various declarative features. */
229 void desugar() { 220 void desugar() {
230 // compile list of attributes to copy to instances 221 // compile list of attributes to copy to instances
231 accumulateInstanceAttributes(); 222 accumulateInstanceAttributes();
232 // parse on-* delegates declared on `this` element 223 // parse on-* delegates declared on `this` element
233 parseHostEvents(); 224 parseHostEvents();
234 // parse on-* delegates declared in templates 225 // parse on-* delegates declared in templates
235 parseLocalEvents(); 226 parseLocalEvents();
236 // install external stylesheets as if they are inline 227 // install external stylesheets as if they are inline
237 installSheets(); 228 installSheets();
229 var cls = reflectClass(type);
238 // TODO(jmesserly): this feels unnatrual in Dart. Since we have convenient 230 // TODO(jmesserly): this feels unnatrual in Dart. Since we have convenient
239 // lazy static initialization, can we get by without it? 231 // lazy static initialization, can we get by without it?
240 var registered = type.methods[const Symbol('registerCallback')]; 232 var registered = cls.methods[const Symbol('registerCallback')];
241 if (registered != null && registered.isStatic && 233 if (registered != null && registered.isStatic &&
242 registered.isRegularMethod) { 234 registered.isRegularMethod) {
243 type.invoke(const Symbol('registerCallback'), [this]); 235 cls.invoke(const Symbol('registerCallback'), [this]);
244 } 236 }
245 237
246 } 238 }
247 239
248 void registerType(String name) { 240 void registerType(String name, {String extendsTag}) {
249 // TODO(jmesserly): document.register 241 document.register(name, type, extendsTag: extendsTag);
250 registerCustomElement(name, () =>
251 type.newInstance(const Symbol(''), const []).reflectee);
252 } 242 }
253 243
254 void publishAttributes(ClassMirror type, PolymerDeclaration superDecl) { 244 void publishAttributes(ClassMirror cls, PolymerDeclaration superDecl) {
255 // get properties to publish 245 // get properties to publish
256 if (superDecl != null && superDecl._publish != null) { 246 if (superDecl != null && superDecl._publish != null) {
257 _publish = new Map.from(superDecl._publish); 247 _publish = new Map.from(superDecl._publish);
258 } 248 }
259 _publish = _getProperties(type, _publish, (x) => x is PublishedProperty); 249 _publish = _getProperties(cls, _publish, (x) => x is PublishedProperty);
260 250
261 // merge names from 'attributes' attribute 251 // merge names from 'attributes' attribute
262 var attrs = attributes['attributes']; 252 var attrs = attributes['attributes'];
263 if (attrs != null) { 253 if (attrs != null) {
264 // names='a b c' or names='a,b,c' 254 // names='a b c' or names='a,b,c'
265 // record each name for publishing 255 // record each name for publishing
266 for (var attr in attrs.split(attrs.contains(',') ? ',' : ' ')) { 256 for (var attr in attrs.split(attrs.contains(',') ? ',' : ' ')) {
267 // remove excess ws 257 // remove excess ws
268 attr = attr.trim(); 258 attr = attr.trim();
269 259
270 // do not override explicit entries 260 // do not override explicit entries
271 if (_publish != null && _publish.containsKey(attr)) continue; 261 if (_publish != null && _publish.containsKey(attr)) continue;
272 262
273 var property = new Symbol(attr); 263 var property = new Symbol(attr);
274 var mirror = type.variables[property]; 264 var mirror = cls.variables[property];
275 if (mirror == null) { 265 if (mirror == null) {
276 mirror = type.getters[property]; 266 mirror = cls.getters[property];
277 if (mirror != null && !_hasSetter(type, mirror)) mirror = null; 267 if (mirror != null && !_hasSetter(cls, mirror)) mirror = null;
278 } 268 }
279 if (mirror == null) { 269 if (mirror == null) {
280 window.console.warn('property for attribute $attr of polymer-element ' 270 window.console.warn('property for attribute $attr of polymer-element '
281 'name=$name not found.'); 271 'name=$name not found.');
282 continue; 272 continue;
283 } 273 }
284 if (_publish == null) _publish = {}; 274 if (_publish == null) _publish = {};
285 _publish[attr] = mirror; 275 _publish[attr] = mirror;
286 } 276 }
287 } 277 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 void addAttributeDelegates(Map<String, String> delegates) { 311 void addAttributeDelegates(Map<String, String> delegates) {
322 attributes.forEach((name, value) { 312 attributes.forEach((name, value) {
323 if (_hasEventPrefix(name)) { 313 if (_hasEventPrefix(name)) {
324 delegates[_removeEventPrefix(name)] = value; 314 delegates[_removeEventPrefix(name)] = value;
325 } 315 }
326 }); 316 });
327 } 317 }
328 318
329 /** Extracts events under the element's <template>. */ 319 /** Extracts events under the element's <template>. */
330 void parseLocalEvents() { 320 void parseLocalEvents() {
331 for (var t in queryAll('template')) { 321 for (var t in this.queryAll('template')) {
332 final events = new Set<String>(); 322 final events = new Set<String>();
333 // acquire delegates from entire subtree at t 323 // acquire delegates from entire subtree at t
334 accumulateTemplatedEvents(t, events); 324 accumulateTemplatedEvents(t, events);
335 if (events.isNotEmpty) { 325 if (events.isNotEmpty) {
336 // store delegate information directly on template 326 // store delegate information directly on template
337 if (_templateDelegates == null) { 327 if (_templateDelegates == null) {
338 _templateDelegates = new Expando<Set<String>>(); 328 _templateDelegates = new Expando<Set<String>>();
339 } 329 }
340 _templateDelegates[t] = events; 330 _templateDelegates[t] = events;
341 } 331 }
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 ..attributes[_STYLE_SCOPE_ATTRIBUTE] = '$name-$scopeDescriptor'; 467 ..attributes[_STYLE_SCOPE_ATTRIBUTE] = '$name-$scopeDescriptor';
478 } 468 }
479 469
480 /** 470 /**
481 * fetch a list of all observable properties names in our inheritance chain 471 * fetch a list of all observable properties names in our inheritance chain
482 * above Polymer. 472 * above Polymer.
483 */ 473 */
484 // TODO(sjmiles): perf: reflection is slow, relatively speaking 474 // TODO(sjmiles): perf: reflection is slow, relatively speaking
485 // If an element may take 6us to create, getCustomPropertyNames might 475 // If an element may take 6us to create, getCustomPropertyNames might
486 // cost 1.6us more. 476 // cost 1.6us more.
487 void inferObservers(ClassMirror type) { 477 void inferObservers(ClassMirror cls) {
488 for (var method in type.methods.values) { 478 for (var method in cls.methods.values) {
489 if (method.isStatic || !method.isRegularMethod) continue; 479 if (method.isStatic || !method.isRegularMethod) continue;
490 480
491 String name = MirrorSystem.getName(method.simpleName); 481 String name = MirrorSystem.getName(method.simpleName);
492 if (name.endsWith('Changed')) { 482 if (name.endsWith('Changed')) {
493 if (_observe == null) _observe = {}; 483 if (_observe == null) _observe = {};
494 name = name.substring(0, name.length - 7); 484 name = name.substring(0, name.length - 7);
495 _observe[name] = method.simpleName; 485 _observe[name] = method.simpleName;
496 } 486 }
497 } 487 }
498 } 488 }
499 489
500 void publishProperties(ClassMirror type) { 490 void publishProperties(Type type) {
501 // Dart note: _publish was already populated by publishAttributes 491 // Dart note: _publish was already populated by publishAttributes
502 if (_publish != null) _publishLC = _lowerCaseMap(_publish); 492 if (_publish != null) _publishLC = _lowerCaseMap(_publish);
503 } 493 }
504 494
505 Map<String, dynamic> _lowerCaseMap(Map<String, dynamic> properties) { 495 Map<String, dynamic> _lowerCaseMap(Map<String, dynamic> properties) {
506 final map = new Map<String, dynamic>(); 496 final map = new Map<String, dynamic>();
507 properties.forEach((name, value) { 497 properties.forEach((name, value) {
508 map[name.toLowerCase()] = value; 498 map[name.toLowerCase()] = value;
509 }); 499 });
510 return map; 500 return map;
511 } 501 }
512 } 502 }
513 503
514 /// maps tag names to prototypes 504 /// maps tag names to prototypes
515 final Map _typesByName = new Map<String, ClassMirror>(); 505 final Map _typesByName = new Map<String, Type>();
516 506
517 ClassMirror _getRegisteredType(String name) => _typesByName[name]; 507 Type _getRegisteredType(String name) => _typesByName[name];
518 508
519 /// elements waiting for prototype, by name 509 /// elements waiting for prototype, by name
520 final Map _waitType = new Map<String, PolymerDeclaration>(); 510 final Map _waitType = new Map<String, PolymerDeclaration>();
521 511
522 void _notifyType(String name) { 512 void _notifyType(String name) {
523 var waiting = _waitType.remove(name); 513 var waiting = _waitType.remove(name);
524 if (waiting != null) waiting.registerWhenReady(); 514 if (waiting != null) waiting.registerWhenReady();
525 } 515 }
526 516
527 /// elements waiting for super, by name 517 /// elements waiting for super, by name
528 final Map _waitSuper = new Map<String, List<PolymerDeclaration>>(); 518 final Map _waitSuper = new Map<String, List<PolymerDeclaration>>();
529 519
530 void _notifySuper(String name) { 520 void _notifySuper(String name) {
531 _registered.add(name); 521 _registered.add(name);
532 var waiting = _waitSuper.remove(name); 522 var waiting = _waitSuper.remove(name);
533 if (waiting != null) { 523 if (waiting != null) {
534 for (var w in waiting) { 524 for (var w in waiting) {
535 w.registerWhenReady(); 525 w.registerWhenReady();
536 } 526 }
537 } 527 }
538 } 528 }
539 529
540 /// track document.register'ed tag names 530 /// track document.register'ed tag names
541 final Set _registered = new Set<String>(); 531 final Set _registered = new Set<String>();
542 532
543 bool _isRegistered(name) => _registered.contains(name); 533 bool _isRegistered(name) => _registered.contains(name);
544 534
545 final Map _declarations = new Map<ClassMirror, PolymerDeclaration>(); 535 final Map _declarations = new Map<Type, PolymerDeclaration>();
546 536
547 PolymerDeclaration _getDeclaration(ClassMirror type) => _declarations[type]; 537 PolymerDeclaration _getDeclaration(Type type) => _declarations[type];
548 538
549 final _objectType = reflectClass(Object); 539 final _objectType = reflectClass(Object);
550 540
551 Map _getProperties(ClassMirror type, Map props, bool matches(metadata)) { 541 Map _getProperties(ClassMirror cls, Map props, bool matches(metadata)) {
552 for (var field in type.variables.values) { 542 for (var field in cls.variables.values) {
553 if (field.isFinal || field.isStatic || field.isPrivate) continue; 543 if (field.isFinal || field.isStatic || field.isPrivate) continue;
554 544
555 for (var meta in field.metadata) { 545 for (var meta in field.metadata) {
556 if (matches(meta.reflectee)) { 546 if (matches(meta.reflectee)) {
557 if (props == null) props = {}; 547 if (props == null) props = {};
558 props[MirrorSystem.getName(field.simpleName)] = field; 548 props[MirrorSystem.getName(field.simpleName)] = field;
559 break; 549 break;
560 } 550 }
561 } 551 }
562 } 552 }
563 553
564 for (var getter in type.getters.values) { 554 for (var getter in cls.getters.values) {
565 if (getter.isStatic || getter.isPrivate) continue; 555 if (getter.isStatic || getter.isPrivate) continue;
566 556
567 for (var meta in getter.metadata) { 557 for (var meta in getter.metadata) {
568 if (matches(meta.reflectee)) { 558 if (matches(meta.reflectee)) {
569 if (_hasSetter(type, getter)) { 559 if (_hasSetter(cls, getter)) {
570 if (props == null) props = {}; 560 if (props == null) props = {};
571 props[MirrorSystem.getName(getter.simpleName)] = getter; 561 props[MirrorSystem.getName(getter.simpleName)] = getter;
572 } 562 }
573 break; 563 break;
574 } 564 }
575 } 565 }
576 } 566 }
577 567
578 return props; 568 return props;
579 } 569 }
580 570
581 bool _hasSetter(ClassMirror type, MethodMirror getter) { 571 bool _hasSetter(ClassMirror cls, MethodMirror getter) {
582 var setterName = new Symbol('${MirrorSystem.getName(getter.simpleName)}='); 572 var setterName = new Symbol('${MirrorSystem.getName(getter.simpleName)}=');
583 return type.setters.containsKey(setterName); 573 return cls.setters.containsKey(setterName);
584 } 574 }
585 575
586 bool _inDartHtml(ClassMirror type) =>
587 type.owner.simpleName == const Symbol('dart.dom.html');
588
589 576
590 /** Attribute prefix used for declarative event handlers. */ 577 /** Attribute prefix used for declarative event handlers. */
591 const _EVENT_PREFIX = 'on-'; 578 const _EVENT_PREFIX = 'on-';
592 579
593 /** Whether an attribute declares an event. */ 580 /** Whether an attribute declares an event. */
594 bool _hasEventPrefix(String attr) => attr.startsWith(_EVENT_PREFIX); 581 bool _hasEventPrefix(String attr) => attr.startsWith(_EVENT_PREFIX);
595 582
596 String _removeEventPrefix(String name) => name.substring(_EVENT_PREFIX.length); 583 String _removeEventPrefix(String name) => name.substring(_EVENT_PREFIX.length);
597 584
598 /** 585 /**
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 return map; 691 return map;
705 }(); 692 }();
706 693
707 // Dart note: we need this function because we have additional renames JS does 694 // Dart note: we need this function because we have additional renames JS does
708 // not have. The JS renames are simply case differences, whereas we have ones 695 // not have. The JS renames are simply case differences, whereas we have ones
709 // like doubleclick -> dblclick and stripping the webkit prefix. 696 // like doubleclick -> dblclick and stripping the webkit prefix.
710 String _eventNameFromType(String eventType) { 697 String _eventNameFromType(String eventType) {
711 final result = _reverseEventTranslations[eventType]; 698 final result = _reverseEventTranslations[eventType];
712 return result != null ? result : eventType; 699 return result != null ? result : eventType;
713 } 700 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698