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

Unified Diff: pkg/polymer/lib/boot.js

Issue 24149003: Port of github.com/polymer/polymer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/polymer/example/component/news/web/news-component.html ('k') | pkg/polymer/lib/component_build.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/lib/boot.js
diff --git a/pkg/polymer/lib/boot.js b/pkg/polymer/lib/boot.js
index 0a3fe62baaf390456fa263a261a799f8873919a8..2bcb5902bd085fb5cd76725f2780d10b71b63439 100644
--- a/pkg/polymer/lib/boot.js
+++ b/pkg/polymer/lib/boot.js
@@ -56,8 +56,30 @@
' tool to compile a depolyable JavaScript version')
return;
}
- document.write(
- '<script src="packages/html_import/html_import.min.js"></script>');
+
+
+ // Load HTML Imports:
+ var htmlImportsSrc = 'src="packages/html_import/html_import.min.js"';
+ document.write('<script ' + htmlImportsSrc + '></script>');
+ var importScript = document.querySelector('script[' + htmlImportsSrc + ']');
+ importScript.addEventListener('load', function() {
+ // NOTE: this is from polymer/src/lib/dom.js
+ window.HTMLImports.importer.preloadSelectors +=
+ ', polymer-element link[rel=stylesheet]';
+ });
+
+ // TODO(jmesserly): we need this in deploy tool too.
+ // NOTE: this is from polymer/src/boot.js:
+ // FOUC prevention tactic
+ var style = document.createElement('style');
+ style.textContent = 'body {opacity: 0;}';
+ var head = document.querySelector('head');
+ head.insertBefore(style, head.firstChild);
+
+ window.addEventListener('WebComponentsReady', function() {
+ document.body.style.webkitTransition = 'opacity 0.3s';
+ document.body.style.opacity = 1;
+ });
// Extract a Dart import URL from a script tag, which is the 'src' attribute
// of the script tag, or a data-url with the script contents for inlined code.
« no previous file with comments | « pkg/polymer/example/component/news/web/news-component.html ('k') | pkg/polymer/lib/component_build.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698