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

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

Issue 528093002: FOUC lint test (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: update changelog/pubspec Created 6 years, 3 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 | « pkg/polymer/CHANGELOG.md ('k') | pkg/polymer/pubspec.yaml » ('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 3ec663769151c6e0897c15c8178257374c4d84b3..80f21ef6ff91372f672312cfa7d76e12291e1c1a 100644
--- a/pkg/polymer/lib/src/build/linter.dart
+++ b/pkg/polymer/lib/src/build/linter.dart
@@ -393,6 +393,28 @@ class _LinterVisitor extends TreeVisitor {
'Did you mean to write <$baseTag is="$customTagName">?',
span: node.sourceSpan);
}
+
+ // FOUC check, if content is supplied
+ if (!node.innerHtml.isEmpty) {
+ var parent = node;
+ var hasFoucFix = false;
+ while (parent != null && !hasFoucFix) {
+ if (parent.localName == 'polymer-element' ||
+ parent.attributes['unresolved'] != null) {
+ hasFoucFix = true;
+ }
+ if (parent.localName == 'body') break;
+ parent = parent.parent;
+ }
+ if (!hasFoucFix) {
+ _logger.warning(
+ 'Custom element found in document body without an '
+ '"unresolved" attribute on it or one of its parents. This means '
+ 'your app probably has a flash of unstyled content before it '
+ 'finishes loading. See http://goo.gl/iN03Pj for more info.',
+ span: node.sourceSpan);
+ }
+ }
}
/// Validate an attribute on a custom-element. Returns true if valid.
« no previous file with comments | « pkg/polymer/CHANGELOG.md ('k') | pkg/polymer/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698