| 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 // 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 /** | 9 /** |
| 10 * Model-Driven Views (MDV)'s native features enables a wide-range of use cases, | 10 * Model-Driven Views (MDV)'s native features enables a wide-range of use cases, |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 * already decorated. | 126 * already decorated. |
| 127 */ | 127 */ |
| 128 @Experimental() | 128 @Experimental() |
| 129 static bool decorate(Element template, [Element instanceRef]) { | 129 static bool decorate(Element template, [Element instanceRef]) { |
| 130 // == true check because it starts as a null field. | 130 // == true check because it starts as a null field. |
| 131 if (template._templateIsDecorated == true) return false; | 131 if (template._templateIsDecorated == true) return false; |
| 132 | 132 |
| 133 _injectStylesheet(); | 133 _injectStylesheet(); |
| 134 | 134 |
| 135 var templateElement = template; | 135 var templateElement = template; |
| 136 templateElement._templateIsDecorated = true; |
| 136 var isNative = templateElement is TemplateElement; | 137 var isNative = templateElement is TemplateElement; |
| 137 var bootstrapContents = isNative; | 138 var bootstrapContents = isNative; |
| 138 var liftContents = !isNative; | 139 var liftContents = !isNative; |
| 139 var liftRoot = false; | 140 var liftRoot = false; |
| 140 | 141 |
| 141 if (!isNative && templateElement._isAttributeTemplate) { | 142 if (!isNative && templateElement._isAttributeTemplate) { |
| 142 if (instanceRef != null) { | 143 if (instanceRef != null) { |
| 143 // TODO(jmesserly): this is just an assert in MDV. | 144 // TODO(jmesserly): this is just an assert in MDV. |
| 144 throw new ArgumentError('instanceRef should not be supplied for ' | 145 throw new ArgumentError('instanceRef should not be supplied for ' |
| 145 'attribute templates.'); | 146 'attribute templates.'); |
| 146 } | 147 } |
| 147 templateElement = _extractTemplateFromAttributeTemplate(template); | 148 templateElement = _extractTemplateFromAttributeTemplate(template); |
| 149 templateElement._templateIsDecorated = true; |
| 148 isNative = templateElement is TemplateElement; | 150 isNative = templateElement is TemplateElement; |
| 149 liftRoot = true; | 151 liftRoot = true; |
| 150 } | 152 } |
| 151 | 153 |
| 152 templateElement._templateIsDecorated = true; | |
| 153 | |
| 154 if (!isNative) { | 154 if (!isNative) { |
| 155 var doc = _getTemplateContentsOwner(templateElement.document); | 155 var doc = _getTemplateContentsOwner(templateElement.document); |
| 156 templateElement._templateContent = doc.createDocumentFragment(); | 156 templateElement._templateContent = doc.createDocumentFragment(); |
| 157 } | 157 } |
| 158 | 158 |
| 159 if (instanceRef != null) { | 159 if (instanceRef != null) { |
| 160 // template is contained within an instance, its direct content must be | 160 // template is contained within an instance, its direct content must be |
| 161 // empty | 161 // empty |
| 162 templateElement._templateInstanceRef = instanceRef; | 162 templateElement._templateInstanceRef = instanceRef; |
| 163 } else if (liftContents) { | 163 } else if (liftContents) { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 td[template], | 283 td[template], |
| 284 caption[template], | 284 caption[template], |
| 285 colgroup[template], | 285 colgroup[template], |
| 286 col[template], | 286 col[template], |
| 287 option[template] { | 287 option[template] { |
| 288 display: none; | 288 display: none; |
| 289 }'''; | 289 }'''; |
| 290 document.head.append(style); | 290 document.head.append(style); |
| 291 } | 291 } |
| 292 } | 292 } |
| OLD | NEW |