| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** Collects several code emitters for the template tool. */ | 5 /** Collects several code emitters for the template tool. */ |
| 6 library emitters; | 6 library emitters; |
| 7 | 7 |
| 8 import 'package:csslib/parser.dart' as css; | 8 import 'package:csslib/parser.dart' as css; |
| 9 import 'package:csslib/visitor.dart'; | 9 import 'package:csslib/visitor.dart'; |
| 10 import 'package:html5lib/dom.dart'; | 10 import 'package:html5lib/dom.dart'; |
| (...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 var bootstrapScript = parseFragment( | 914 var bootstrapScript = parseFragment( |
| 915 '<script type="application/dart" src="$bootstrapOutName"></script>'); | 915 '<script type="application/dart" src="$bootstrapOutName"></script>'); |
| 916 if (dartLoaderTag == null) { | 916 if (dartLoaderTag == null) { |
| 917 document.body.nodes.add(bootstrapScript); | 917 document.body.nodes.add(bootstrapScript); |
| 918 document.body.nodes.add(parseFragment( | 918 document.body.nodes.add(parseFragment( |
| 919 '<script type="text/javascript" src="packages/browser/dart.js">' | 919 '<script type="text/javascript" src="packages/browser/dart.js">' |
| 920 '</script>\n')); | 920 '</script>\n')); |
| 921 } else if (dartLoaderTag.parent != document.body) { | 921 } else if (dartLoaderTag.parent != document.body) { |
| 922 document.body.nodes.add(bootstrapScript); | 922 document.body.nodes.add(bootstrapScript); |
| 923 } else { | 923 } else { |
| 924 document.body.nodes.insertBefore(bootstrapScript, dartLoaderTag); | 924 document.body.insertBefore(bootstrapScript, dartLoaderTag); |
| 925 } | 925 } |
| 926 | 926 |
| 927 // Insert the "auto-generated" comment after the doctype, otherwise IE will | 927 // Insert the "auto-generated" comment after the doctype, otherwise IE will |
| 928 // go into quirks mode. | 928 // go into quirks mode. |
| 929 int commentIndex = 0; | 929 int commentIndex = 0; |
| 930 DocumentType doctype = find(document.nodes, (n) => n is DocumentType); | 930 DocumentType doctype = find(document.nodes, (n) => n is DocumentType); |
| 931 if (doctype != null) { | 931 if (doctype != null) { |
| 932 commentIndex = document.nodes.indexOf(doctype) + 1; | 932 commentIndex = document.nodes.indexOf(doctype) + 1; |
| 933 // TODO(jmesserly): the html5lib parser emits a warning for missing | 933 // TODO(jmesserly): the html5lib parser emits a warning for missing |
| 934 // doctype, but it allows you to put it after comments. Presumably they do | 934 // doctype, but it allows you to put it after comments. Presumably they do |
| (...skipping 17 matching lines...) Expand all Loading... |
| 952 return """ | 952 return """ |
| 953 // Auto-generated from $filename. | 953 // Auto-generated from $filename. |
| 954 // DO NOT EDIT. | 954 // DO NOT EDIT. |
| 955 $lib | 955 $lib |
| 956 import 'dart:html' as autogenerated; | 956 import 'dart:html' as autogenerated; |
| 957 import 'dart:svg' as autogenerated_svg; | 957 import 'dart:svg' as autogenerated_svg; |
| 958 import 'package:web_ui/web_ui.dart' as autogenerated; | 958 import 'package:web_ui/web_ui.dart' as autogenerated; |
| 959 import 'package:web_ui/observe/observable.dart' as __observe; | 959 import 'package:web_ui/observe/observable.dart' as __observe; |
| 960 """; | 960 """; |
| 961 } | 961 } |
| OLD | NEW |