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

Side by Side Diff: pkg/mdv/lib/src/template_iterator.dart

Issue 20886002: add custom_element package (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « pkg/custom_element/test/custom_element_test.dart ('k') | pkg/mdv/test/analyzer_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 part of mdv; 5 part of mdv;
6 6
7 // This code is a port of Model-Driven-Views: 7 // This code is a port of Model-Driven-Views:
8 // https://github.com/polymer-project/mdv 8 // https://github.com/polymer-project/mdv
9 // The code mostly comes from src/template_element.js 9 // The code mostly comes from src/template_element.js
10 10
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 bool _isSimpleBinding(List<String> tokens) => 152 bool _isSimpleBinding(List<String> tokens) =>
153 tokens.length == 3 && tokens[0].isEmpty && tokens[2].isEmpty; 153 tokens.length == 3 && tokens[0].isEmpty && tokens[2].isEmpty;
154 154
155 /** 155 /**
156 * Parses {{ mustache }} bindings. 156 * Parses {{ mustache }} bindings.
157 * 157 *
158 * Returns null if there are no matches. Otherwise returns 158 * Returns null if there are no matches. Otherwise returns
159 * [TEXT, (PATH, TEXT)+] if there is at least one mustache. 159 * [TEXT, (PATH, TEXT)+] if there is at least one mustache.
160 */ 160 */
161 List<String> _parseMustacheTokens(String s) { 161 List<String> _parseMustacheTokens(String s) {
162 if (s.isEmpty) return; 162 if (s.isEmpty) return null;
163 163
164 var tokens = null; 164 var tokens = null;
165 var length = s.length; 165 var length = s.length;
166 var startIndex = 0, lastIndex = 0, endIndex = 0; 166 var startIndex = 0, lastIndex = 0, endIndex = 0;
167 while (lastIndex < length) { 167 while (lastIndex < length) {
168 startIndex = s.indexOf('{{', lastIndex); 168 startIndex = s.indexOf('{{', lastIndex);
169 endIndex = startIndex < 0 ? -1 : s.indexOf('}}', startIndex + 2); 169 endIndex = startIndex < 0 ? -1 : s.indexOf('}}', startIndex + 2);
170 170
171 if (endIndex < 0) { 171 if (endIndex < 0) {
172 if (tokens == null) return null; 172 if (tokens == null) return null;
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 nodeExt._templateIterator = null; 401 nodeExt._templateIterator = null;
402 } 402 }
403 } 403 }
404 404
405 _nodeOrCustom(node).unbindAll(); 405 _nodeOrCustom(node).unbindAll();
406 for (var c = node.firstChild; c != null; c = c.nextNode) { 406 for (var c = node.firstChild; c != null; c = c.nextNode) {
407 _unbindAllRecursively(c); 407 _unbindAllRecursively(c);
408 } 408 }
409 } 409 }
410 } 410 }
OLDNEW
« no previous file with comments | « pkg/custom_element/test/custom_element_test.dart ('k') | pkg/mdv/test/analyzer_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698