Chromium Code Reviews| Index: pkg/polymer/lib/src/boot.dart |
| diff --git a/pkg/polymer/lib/src/boot.dart b/pkg/polymer/lib/src/boot.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b4fb82275d9255ec0d771af214791d869e11dff7 |
| --- /dev/null |
| +++ b/pkg/polymer/lib/src/boot.dart |
| @@ -0,0 +1,22 @@ |
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +/** Ported from `polymer/src/boot.js`. **/ |
|
Siggi Cherem (dart-lang)
2013/10/17 01:46:49
this matches polymer's code structure. The code be
|
| +part of polymer; |
| + |
| +/** Prevent a flash of unstyled content. */ |
| +preventFuoc() { |
| + var style = new StyleElement(); |
| + style.text = r'body {opacity: 0;}'; |
| + // Note: we use `query` and not `document.head` to make sure this code works |
| + // with the shadow_dom polyfill (a limitation of the polyfill is that it can't |
| + // override the definitions of document, document.head, or document.body). |
| + var head = query('head'); |
| + head.insertBefore(style, head.firstChild); |
| + |
| + Polymer.onReady.then((_) { |
| + document.body.style.transition = 'opacity 0.3s'; |
| + document.body.style.opacity = '1'; |
| + }); |
| +} |