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

Unified Diff: lib/src/analyzer.dart

Issue 11359215: Ensure parent id added only when we need an identifier for the child (Closed) Base URL: git@github.com:dart-lang/dart-web-components.git@master
Patch Set: Created 8 years, 1 month 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 | « no previous file | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/analyzer.dart
diff --git a/lib/src/analyzer.dart b/lib/src/analyzer.dart
index 5d7ed4f81406ee6b3ad7885faa8f11cad0106e02..68ec980a6302e09285511121c9b037f6812ce8cf 100644
--- a/lib/src/analyzer.dart
+++ b/lib/src/analyzer.dart
@@ -88,8 +88,6 @@ class _Analyzer extends TreeVisitor {
void visitElementInfo(ElementInfo info) {
var node = info.node;
- _ensureParentHasQuery(info);
-
if (node.id != '') info.identifier = '_${toCamelCase(node.id)}';
if (node.tagName == 'body' || (_currentInfo is ComponentInfo
&& (_currentInfo as ComponentInfo).template == node)) {
@@ -129,12 +127,15 @@ class _Analyzer extends TreeVisitor {
_parent = savedParent;
- if (info.identifier == null && _needsIdentifier(info)) {
- var id = '__e-$_uniqueId';
- info.identifier = toCamelCase(id);
- // If it's not created in code, we'll query the element by it's id.
- if (!info.createdInCode) node.attributes['id'] = id;
- _uniqueId++;
+ if (_needsIdentifier(info)) {
+ _ensureParentHasQuery(info);
+ if (info.identifier == null) {
+ var id = '__e-$_uniqueId';
+ info.identifier = toCamelCase(id);
+ // If it's not created in code, we'll query the element by it's id.
+ if (!info.createdInCode) node.attributes['id'] = id;
+ _uniqueId++;
+ }
}
}
« no previous file with comments | « no previous file | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698