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

Side by Side Diff: lib/src/html_cleaner.dart

Issue 13592003: add support for template repeat (Closed) Base URL: https://github.com/dart-lang/web-ui.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
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 /** 5 /**
6 * Part of the template compilation that concerns with simplifying HTML trees to 6 * Part of the template compilation that concerns with simplifying HTML trees to
7 * emit trimmed simple HTML code. 7 * emit trimmed simple HTML code.
8 */ 8 */
9 library html_cleaner; 9 library html_cleaner;
10 10
(...skipping 19 matching lines...) Expand all
30 _component = oldComponent; 30 _component = oldComponent;
31 } 31 }
32 32
33 void visitElementInfo(ElementInfo info) { 33 void visitElementInfo(ElementInfo info) {
34 var node = info.node; 34 var node = info.node;
35 info.removeAttributes.forEach(node.attributes.remove); 35 info.removeAttributes.forEach(node.attributes.remove);
36 info.removeAttributes.clear(); 36 info.removeAttributes.clear();
37 37
38 // Hide all template elements. At the very least, we must do this for 38 // Hide all template elements. At the very least, we must do this for
39 // template attributes, such as `<td template if="cond">`. 39 // template attributes, such as `<td template if="cond">`.
40 if (info.hasIfCondition && !info.isTemplateElement) { 40 if (info is TemplateInfo && !info.isTemplateElement &&
41 (info.hasCondition || info.isRepeat)) {
Siggi Cherem (dart-lang) 2013/04/05 20:09:24 why not info.hasLoop?
Jennifer Messerly 2013/04/05 20:34:36 wow, the comment is way out of date. I've fixed it
41 node.attributes['style'] = 'display:none'; 42 node.attributes['style'] = 'display:none';
42 } 43 }
43 44
44 if (info.childrenCreatedInCode) { 45 if (info.childrenCreatedInCode) {
45 node.nodes.clear(); 46 node.nodes.clear();
46 } 47 }
47 48
48 if (node.tagName == 'style' && node.attributes.containsKey("scoped") && 49 if (node.tagName == 'style' && node.attributes.containsKey("scoped") &&
49 _component != null) { 50 _component != null) {
50 // Remove the style tag we've parsed the CSS. 51 // Remove the style tag we've parsed the CSS.
51 node.remove(); 52 node.remove();
52 } 53 }
53 54
54 super.visitElementInfo(info); 55 super.visitElementInfo(info);
55 } 56 }
56 } 57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698