| Index: lib/compiler/implementation/emitter.dart
|
| ===================================================================
|
| --- lib/compiler/implementation/emitter.dart (revision 5976)
|
| +++ lib/compiler/implementation/emitter.dart (working copy)
|
| @@ -709,7 +709,8 @@
|
| mainCall = '${namer.isolateAccess(main)}()';
|
| }
|
| buffer.add("""
|
| -if (typeof window != 'undefined' && window.addEventListener) {
|
| +if (typeof window != 'undefined' && typeof document != 'undefined' &&
|
| + window.addEventListener && document.readyState == 'loading') {
|
| window.addEventListener('DOMContentLoaded', function(e) {
|
| ${mainCall};
|
| });
|
|
|