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

Unified Diff: lib/templating.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/info.dart ('k') | test/analyzer_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/templating.dart
diff --git a/lib/templating.dart b/lib/templating.dart
index b8cb7856c23cad7299c3807312fa403d70176a92..0fbf23eb493a0aa5db6a21280a84af49064a7482 100644
--- a/lib/templating.dart
+++ b/lib/templating.dart
@@ -455,11 +455,22 @@ class Template extends TemplateItem {
children.add(new ConditionalTemplate(template, exp, bodySetup));
}
- /** Watch [exp] and render a loop while this template is visible. */
- void loop(Node template, exp, iterSetup, {isTemplateElement: true}) {
- children.add(
- isTemplateElement ? new LoopTemplate(template, exp, iterSetup)
- : new LoopTemplateInAttribute(template, exp, iterSetup));
+ /**
+ * Watch [exp] and render a loop while this template is visible.
+ * This is used by all "iterate" and "repeat" attributes, except those that
+ * require [loopIterateAttr].
+ */
+ void loop(Node template, exp, iterSetup) {
+ children.add(new LoopTemplate(template, exp, iterSetup));
+ }
+
+ /**
+ * Watch [exp] and render a loop while this template is visible.
+ * This is used by:
+ * <td template iterate="x in list">
+ */
+ void loopIterateAttr(Node template, exp, iterSetup) {
+ children.add(new LoopTemplateInAttribute(template, exp, iterSetup));
}
/** Bind the lifecycle of the component with this template's lifecycle. */
@@ -601,7 +612,10 @@ class ConditionalTemplate extends PlaceholderTemplate {
/** Function to set up the contents of a loop template. */
typedef void LoopIterationSetup(loopVariable, Template template);
-/** A template loop of the form `<template iterate="x in list ">`. */
+/**
+ * A template loop of the form `<template iterate="x in list ">` or
+ * `<td template repeat="x in list">`.
+ */
class LoopTemplate extends PlaceholderTemplate {
final LoopIterationSetup iterSetup;
« no previous file with comments | « lib/src/info.dart ('k') | test/analyzer_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698