Create elements after imports are resolved

This is better fix for Safari run-time exception.

Bug: Issue 4438
Change-Id: I25fd1aa47293f299d1a52c082e403ca95e036de0
This commit is contained in:
Viktar Donich
2016-08-25 15:54:19 -07:00
parent 623e917b6f
commit 6606704b15
2 changed files with 8 additions and 8 deletions

View File

@@ -15,7 +15,7 @@ limitations under the License.
-->
<link rel="import" href="../../../bower_components/polymer/polymer.html">
<link rel="import" href="../../shared/gr-rest-api-interface/gr-rest-api-interface.html">
<link rel="import" href="../../core/gr-reporting/gr-reporting.html">
<link rel="import" href="../gr-reporting/gr-reporting.html">
<script src="../../../bower_components/page/page.js"></script>
<script src="gr-router.js"></script>

View File

@@ -17,15 +17,15 @@
// Polymer makes `app` intrinsically defined on the window by virtue of the
// custom element having the id "app", but it is made explicit here.
var app = document.querySelector('#app');
var restAPI = document.createElement('gr-rest-api-interface');
if (!app) {
console.log('No gr-app found (running tests)');
return;
}
window.addEventListener('WebComponentsReady', function() {
if (!app) {
console.log('No gr-app found (runing in test mode)');
return;
}
// TODO (viktard): Fix properly.
var reporting = app.$.reporting;
var restAPI = document.createElement('gr-rest-api-interface');
var reporting = document.createElement('gr-reporting');
reporting.timeEnd('WebComponentsReady');
reporting.pageLoaded();