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

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

Issue 227743009: [polymer] fix imports in Dartium if no script is on the main page (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | pkg/polymer/lib/polymer.html » ('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 e0fe90c725c8a95fb519ee2c62ee7998cfd5ffef..a4a148e3c3a6f72d7cb8e6113ec6f8f2f1f9eb92 100644
--- a/pkg/polymer/lib/boot.js
+++ b/pkg/polymer/lib/boot.js
@@ -124,31 +124,9 @@
return state;
}
- // Waits for all imports to be loaded, then calls [callback].
- function onImportsReady(callback) {
- // Note: we only need to check the main document because an import is loaded
- // only when all it's transitive imports are loaded too.
- var links = document.querySelectorAll('link[rel="import"]');
- var total = links.length;
- var loaded = 0;
- function incrementLoaded() {
- loaded++;
- if (loaded == total) {
- window.addEventListener('DOMContentLoaded', callback);
- }
- }
-
- for (var i = 0; i < total; i++) {
- var node = links[i];
- if (node.import) {
- incrementLoaded();
- } else {
- node.addEventListener('load', incrementLoaded);
- }
- }
- }
-
- onImportsReady(function () {
+ // TODO(jmesserly): we're using this function because DOMContentLoaded can
+ // be fired too soon: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23526
+ HTMLImports.whenImportsReady(function() {
// Append a new script tag that initializes everything.
var newScript = document.createElement('script');
newScript.type = "application/dart";
@@ -160,7 +138,7 @@
+ 'separtate isolates. To prepare for this all the following '
+ 'script tags need to be updated to use the mime-type '
+ '"application/dart;component=1" instead of "application/dart":');
- for (var i = 0; i < results.badTags.length; i++) {
+ for (var i = 0; i < results.badTags.length; i++) {
console.warn(results.badTags[i]);
}
}
« no previous file with comments | « no previous file | pkg/polymer/lib/polymer.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698