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

Unified Diff: pkg/polymer/lib/src/build/linter.dart

Issue 362553005: Check that script tag has at least src or inlined text, add unrelated test (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 | « no previous file | pkg/polymer/test/build/linter_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/lib/src/build/linter.dart
diff --git a/pkg/polymer/lib/src/build/linter.dart b/pkg/polymer/lib/src/build/linter.dart
index c1127eeec9c61a40849b39324894bbcdb695400e..9e683f422e0db64286ce47eafce6d51ec22dfebc 100644
--- a/pkg/polymer/lib/src/build/linter.dart
+++ b/pkg/polymer/lib/src/build/linter.dart
@@ -287,7 +287,14 @@ class _LinterVisitor extends TreeVisitor {
_dartTagSeen = true;
}
- if (src == null) return;
+ var isEmpty = node.innerHtml.trim() == '';
+
+ if (src == null) {
+ if (isDart && isEmpty) {
+ _logger.warning('script tag seems empty.', span: node.sourceSpan);
+ }
+ return;
+ }
if (src.endsWith('.dart') && !isDart) {
_logger.warning('Wrong script type, expected type="application/dart".',
@@ -301,7 +308,7 @@ class _LinterVisitor extends TreeVisitor {
return;
}
- if (node.innerHtml.trim() != '') {
+ if (!isEmpty) {
_logger.warning('script tag has "src" attribute and also has script '
'text.', span: node.sourceSpan);
}
« no previous file with comments | « no previous file | pkg/polymer/test/build/linter_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698