Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 * **Warning**: this class is experiental and subject to change. | 8 * **Warning**: this class is experiental and subject to change. |
| 9 * | 9 * |
| 10 * The implementation for the `polymer-element` element. | 10 * The implementation for the `polymer-element` element. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 | 61 |
| 62 Map<String, Object> _instanceAttributes; | 62 Map<String, Object> _instanceAttributes; |
| 63 | 63 |
| 64 List<Element> _sheets; | 64 List<Element> _sheets; |
| 65 List<Element> get sheets => _sheets; | 65 List<Element> get sheets => _sheets; |
| 66 | 66 |
| 67 List<Element> _styles; | 67 List<Element> _styles; |
| 68 List<Element> get styles => _styles; | 68 List<Element> get styles => _styles; |
| 69 | 69 |
| 70 DocumentFragment get templateContent { | 70 DocumentFragment get templateContent { |
| 71 final template = this.query('template'); | 71 final template = this.querySelector('template'); |
| 72 return template != null ? template.content : null; | 72 return template != null ? templateBind(template).content : null; |
|
Siggi Cherem (dart-lang)
2013/10/23 01:41:11
I've been thinking about what we discussed in pers
Jennifer Messerly
2013/10/23 02:05:02
using ".content" could be okay as long as you don'
| |
| 73 } | 73 } |
| 74 | 74 |
| 75 /** Maps event names and their associated method in the element class. */ | 75 /** Maps event names and their associated method in the element class. */ |
| 76 final Map<String, String> _eventDelegates = {}; | 76 final Map<String, String> _eventDelegates = {}; |
| 77 | 77 |
| 78 /** Expected events per element node. */ | 78 /** Expected events per element node. */ |
| 79 // TODO(sigmund): investigate whether we need more than 1 set of local events | 79 // TODO(sigmund): investigate whether we need more than 1 set of local events |
| 80 // per element (why does the js implementation stores 1 per template node?) | 80 // per element (why does the js implementation stores 1 per template node?) |
| 81 Expando<Set<String>> _templateDelegates; | 81 Expando<Set<String>> _templateDelegates; |
| 82 | 82 |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 329 // store delegate information directly on template | 329 // store delegate information directly on template |
| 330 if (_templateDelegates == null) { | 330 if (_templateDelegates == null) { |
| 331 _templateDelegates = new Expando<Set<String>>(); | 331 _templateDelegates = new Expando<Set<String>>(); |
| 332 } | 332 } |
| 333 _templateDelegates[t] = events; | 333 _templateDelegates[t] = events; |
| 334 } | 334 } |
| 335 } | 335 } |
| 336 } | 336 } |
| 337 | 337 |
| 338 void accumulateTemplatedEvents(Element node, Set<String> events) { | 338 void accumulateTemplatedEvents(Element node, Set<String> events) { |
| 339 if (node.localName == 'template' && node.content != null) { | 339 if (node.localName == 'template') { |
| 340 accumulateChildEvents(node.content, events); | 340 accumulateChildEvents(templateBind(node).content, events); |
| 341 } | 341 } |
| 342 } | 342 } |
| 343 | 343 |
| 344 void accumulateChildEvents(node, Set<String> events) { | 344 void accumulateChildEvents(node, Set<String> events) { |
| 345 assert(node is Element || node is DocumentFragment); | 345 assert(node is Element || node is DocumentFragment); |
| 346 for (var n in node.children) { | 346 for (var n in node.children) { |
| 347 accumulateEvents(n, events); | 347 accumulateEvents(n, events); |
| 348 } | 348 } |
| 349 } | 349 } |
| 350 | 350 |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 680 return map; | 680 return map; |
| 681 }(); | 681 }(); |
| 682 | 682 |
| 683 // Dart note: we need this function because we have additional renames JS does | 683 // Dart note: we need this function because we have additional renames JS does |
| 684 // not have. The JS renames are simply case differences, whereas we have ones | 684 // not have. The JS renames are simply case differences, whereas we have ones |
| 685 // like doubleclick -> dblclick and stripping the webkit prefix. | 685 // like doubleclick -> dblclick and stripping the webkit prefix. |
| 686 String _eventNameFromType(String eventType) { | 686 String _eventNameFromType(String eventType) { |
| 687 final result = _reverseEventTranslations[eventType]; | 687 final result = _reverseEventTranslations[eventType]; |
| 688 return result != null ? result : eventType; | 688 return result != null ? result : eventType; |
| 689 } | 689 } |
| OLD | NEW |