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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/polymer/test/build/linter_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 /// Logic to validate that developers are correctly using Polymer constructs. 5 /// Logic to validate that developers are correctly using Polymer constructs.
6 /// This is mainly used to produce warnings for feedback in the editor. 6 /// This is mainly used to produce warnings for feedback in the editor.
7 library polymer.src.build.linter; 7 library polymer.src.build.linter;
8 8
9 import 'dart:async'; 9 import 'dart:async';
10 import 'dart:convert'; 10 import 'dart:convert';
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 'the custom element declaration.', span: node.sourceSpan); 386 'the custom element declaration.', span: node.sourceSpan);
387 return; 387 return;
388 } 388 }
389 389
390 if (hasIsAttribute && baseTag != nodeTag) { 390 if (hasIsAttribute && baseTag != nodeTag) {
391 _logger.warning( 391 _logger.warning(
392 'custom element "$customTagName" extends from "$baseTag". ' 392 'custom element "$customTagName" extends from "$baseTag". '
393 'Did you mean to write <$baseTag is="$customTagName">?', 393 'Did you mean to write <$baseTag is="$customTagName">?',
394 span: node.sourceSpan); 394 span: node.sourceSpan);
395 } 395 }
396
397 // FOUC check, if content is supplied
398 if (!node.innerHtml.isEmpty) {
399 var parent = node;
400 var hasFoucFix = false;
401 while(parent != null && !hasFoucFix) {
Siggi Cherem (dart-lang) 2014/09/04 00:12:32 nit: space before '('
402 if (parent.localName == 'polymer-element' ||
403 parent.attributes['unresolved'] != null) {
404 hasFoucFix = true;
405 }
406 if (parent.localName == 'body') break;
407 parent = parent.parent;
408 }
409 if (!hasFoucFix) {
410 _logger.warning(
411 'Custom element found in document body without an '
412 '"unresolved" attribute on it or one of its parents. This means '
413 'your app probably has a flash of unstyled content before it '
414 'finishes loading. See http://goo.gl/iN03Pj for more info.',
415 span: node.sourceSpan);
416 }
417 }
396 } 418 }
397 419
398 /// Validate an attribute on a custom-element. Returns true if valid. 420 /// Validate an attribute on a custom-element. Returns true if valid.
399 bool _validateCustomAttributeName(String name, FileSpan span) { 421 bool _validateCustomAttributeName(String name, FileSpan span) {
400 if (name.contains('-')) { 422 if (name.contains('-')) {
401 var newName = toCamelCase(name); 423 var newName = toCamelCase(name);
402 _logger.warning('PolymerElement no longer recognizes attribute names with ' 424 _logger.warning('PolymerElement no longer recognizes attribute names with '
403 'dashes such as "$name". Use "$newName" or "${newName.toLowerCase()}" ' 425 'dashes such as "$name". Use "$newName" or "${newName.toLowerCase()}" '
404 'instead (both forms are equivalent in HTML).', span: span); 426 'instead (both forms are equivalent in HTML).', span: span);
405 return false; 427 return false;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 '\'<script type="application/dart">export "package:polymer/init.dart";' 486 '\'<script type="application/dart">export "package:polymer/init.dart";'
465 '</script>\' or add your own script tag and call that function. ' 487 '</script>\' or add your own script tag and call that function. '
466 'Make sure the script tag is placed after all HTML imports.'; 488 'Make sure the script tag is placed after all HTML imports.';
467 489
468 const String NO_DART_SCRIPT_AND_EXPERIMENTAL = 490 const String NO_DART_SCRIPT_AND_EXPERIMENTAL =
469 'The experimental bootstrap feature doesn\'t support script tags on ' 491 'The experimental bootstrap feature doesn\'t support script tags on '
470 'the main document (for now).'; 492 'the main document (for now).';
471 493
472 const List<String> INTERNALLY_DEFINED_ELEMENTS = 494 const List<String> INTERNALLY_DEFINED_ELEMENTS =
473 const ['auto-binding-dart', 'polymer-element']; 495 const ['auto-binding-dart', 'polymer-element'];
OLDNEW
« 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