| OLD | NEW |
| 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 @Experimental | 9 @Experimental |
| 10 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { | 10 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 static bool decorate(Element template, [Element instanceRef]) { | 48 static bool decorate(Element template, [Element instanceRef]) { |
| 49 // == true check because it starts as a null field. | 49 // == true check because it starts as a null field. |
| 50 if (template._templateIsDecorated == true) return false; | 50 if (template._templateIsDecorated == true) return false; |
| 51 | 51 |
| 52 template._templateIsDecorated = true; | 52 template._templateIsDecorated = true; |
| 53 | 53 |
| 54 _injectStylesheet(); | 54 _injectStylesheet(); |
| 55 | 55 |
| 56 // Create content | 56 // Create content |
| 57 if (template is! TemplateElement) { | 57 if (template is! TemplateElement) { |
| 58 var doc = _getTemplateContentsOwner(template.document); | 58 var doc = _Bindings._getTemplateContentsOwner(template.document); |
| 59 template._templateContent = doc.createDocumentFragment(); | 59 template._templateContent = doc.createDocumentFragment(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 if (instanceRef != null) { | 62 if (instanceRef != null) { |
| 63 template._templateInstanceRef = instanceRef; | 63 template._templateInstanceRef = instanceRef; |
| 64 return true; // content is empty. | 64 return true; // content is empty. |
| 65 } | 65 } |
| 66 | 66 |
| 67 if (template is TemplateElement) { | 67 if (template is TemplateElement) { |
| 68 _bootstrapTemplatesRecursivelyFrom(template.content); | 68 bootstrap(template.content); |
| 69 } else { | 69 } else { |
| 70 _liftNonNativeTemplateChildrenIntoContent(template); | 70 _Bindings._liftNonNativeChildrenIntoContent(template); |
| 71 } | 71 } |
| 72 | 72 |
| 73 return true; | 73 return true; |
| 74 } | 74 } |
| 75 | 75 |
| 76 /** | 76 /** |
| 77 * This used to decorate recursively all templates from a given node. | 77 * This used to decorate recursively all templates from a given node. |
| 78 * | 78 * |
| 79 * By default [decorate] will be called on templates lazily when certain | 79 * By default [decorate] will be called on templates lazily when certain |
| 80 * properties such as [model] are accessed, but it can be run eagerly to | 80 * properties such as [model] are accessed, but it can be run eagerly to |
| 81 * decorate an entire tree recursively. | 81 * decorate an entire tree recursively. |
| 82 */ | 82 */ |
| 83 // TODO(rafaelw): Review whether this is the right public API. | 83 // TODO(rafaelw): Review whether this is the right public API. |
| 84 @Experimental | 84 @Experimental |
| 85 static void bootstrap(Node content) { | 85 static void bootstrap(Node content) { |
| 86 _bootstrapTemplatesRecursivelyFrom(content); | 86 _Bindings._bootstrapTemplatesRecursivelyFrom(content); |
| 87 } | 87 } |
| 88 | 88 |
| 89 static bool _initStyles; | 89 static bool _initStyles; |
| 90 | 90 |
| 91 static void _injectStylesheet() { | 91 static void _injectStylesheet() { |
| 92 if (_initStyles == true) return; | 92 if (_initStyles == true) return; |
| 93 _initStyles = true; | 93 _initStyles = true; |
| 94 | 94 |
| 95 var style = new StyleElement(); | 95 var style = new StyleElement(); |
| 96 style.text = r''' | 96 style.text = r''' |
| (...skipping 13 matching lines...) Expand all Loading... |
| 110 document.head.append(style); | 110 document.head.append(style); |
| 111 } | 111 } |
| 112 | 112 |
| 113 /** | 113 /** |
| 114 * A mapping of names to Custom Syntax objects. See [CustomBindingSyntax] for | 114 * A mapping of names to Custom Syntax objects. See [CustomBindingSyntax] for |
| 115 * more information. | 115 * more information. |
| 116 */ | 116 */ |
| 117 @Experimental | 117 @Experimental |
| 118 static Map<String, CustomBindingSyntax> syntax = {}; | 118 static Map<String, CustomBindingSyntax> syntax = {}; |
| 119 } | 119 } |
| OLD | NEW |