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

Unified Diff: lib/src/info.dart

Issue 13592003: add support for template repeat (Closed) Base URL: https://github.com/dart-lang/web-ui.git@master
Patch Set: feedback Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/html_cleaner.dart ('k') | lib/templating.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/info.dart
diff --git a/lib/src/info.dart b/lib/src/info.dart
index c01bbcfe2de52d5e4b98f1c1807a2d5eeb78575e..792df8e3fb1c768cdf2119c98c2039304610d5e8 100644
--- a/lib/src/info.dart
+++ b/lib/src/info.dart
@@ -374,10 +374,10 @@ class ElementInfo extends NodeInfo<Element> {
final Set<String> removeAttributes = new Set<String>();
/** Whether the template element has `iterate="... in ...". */
- bool get hasIterate => false;
+ bool get hasLoop => false;
/** Whether the template element has an `if="..."` conditional. */
- bool get hasIfCondition => false;
+ bool get hasCondition => false;
bool get isTemplateElement => false;
@@ -397,8 +397,8 @@ class ElementInfo extends NodeInfo<Element> {
'childrenCreatedInCode: $childrenCreatedInCode, '
'component: $component, '
'descendantHasBinding: $descendantHasBinding, '
- 'hasIterate: $hasIterate, '
- 'hasIfCondition: $hasIfCondition, '
+ 'hasLoop: $hasLoop, '
+ 'hasCondition: $hasCondition, '
'attributes: $attributes, '
'events: $events>';
}
@@ -546,10 +546,20 @@ class TemplateInfo extends ElementInfo {
*/
final String loopItems;
+ /**
+ * If [hasLoop] is true, this indicates if the attribute was "repeat" instead
+ * of "iterate".
+ *
+ * For template elements, the two are equivalent, but for template attributes
+ * repeat causes that node to repeat in place, instead of iterating its
+ * children.
+ */
+ final bool isRepeat;
+
TemplateInfo(Node node, ElementInfo parent,
- {this.ifCondition, this.loopVariable, this.loopItems})
+ {this.ifCondition, this.loopVariable, this.loopItems, this.isRepeat})
: super(node, parent) {
- childrenCreatedInCode = hasIfCondition || hasIterate;
+ childrenCreatedInCode = hasCondition || hasLoop;
}
/**
@@ -558,9 +568,9 @@ class TemplateInfo extends ElementInfo {
*/
bool get isTemplateElement => node.tagName == 'template';
- bool get hasIfCondition => ifCondition != null;
+ bool get hasCondition => ifCondition != null;
- bool get hasIterate => loopVariable != null;
+ bool get hasLoop => loopVariable != null;
String toString() => '#<TemplateInfo ${super.toString()}'
'ifCondition: $ifCondition, '
« no previous file with comments | « lib/src/html_cleaner.dart ('k') | lib/templating.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698