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

Unified Diff: lib/src/codegen/html_codegen.dart

Issue 1587693002: Avoid parsing and then generating HTML for documents without Dart scripts. This is a fragile workar… (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: fix comment Created 4 years, 11 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/codegen/html_codegen.dart
diff --git a/lib/src/codegen/html_codegen.dart b/lib/src/codegen/html_codegen.dart
index 6c56220d83c3afe00f501aaf59d034699d2ede6f..da35c2cc279987154aa0667bb1e2f23214294557 100644
--- a/lib/src/codegen/html_codegen.dart
+++ b/lib/src/codegen/html_codegen.dart
@@ -28,7 +28,14 @@ String generateEntryHtml(HtmlSourceNode root, AbstractCompiler compiler) {
var scripts = document.querySelectorAll('script[type="application/dart"]');
if (scripts.isEmpty) {
_log.warning('No <script type="application/dart"> found in ${root.uri}');
- return '${document.outerHtml}\n';
+ // TODO(jacobr): we would rather return document.outerHtml to avoid future
+ // bugs that would only show up with html files include references to Dart
+ // scripts. Passing through the input content is needed to avoid breaking
+ // Angular ecause the spec-compliant HTML parser used modifies the HTML
+ // in a way that breaks Angular templates. An alternate fix would be to
+ // write an HTML emitter that preserves the structure of the input HTML as
+ // much as possible.
+ return root.contents;
}
scripts.skip(1).forEach((s) {
// TODO(sigmund): allow more than one Dart script tags?
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698