Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
include a default transition for body opacity (which we never clean up)
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott J. Miles committed Feb 4, 2014
1 parent 4adcc86 commit ea2ff2d
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/unresolved.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,23 @@
* license that can be found in the LICENSE file.
*/
(function(scope) {

// TODO(sorvell): It's desireable to provide a default stylesheet
// that's convenient for styling unresolved elements, but
// it's cumbersome to have to include this manually in every page.
// It would make sense to put inside some HTMLImport but
// the HTMLImports polyfill does not allow loading of stylesheets
// that block rendering. Therefore this injection is tolerated here.
var UNRESOLVED = 'unresolved';
var UNRESOLVED_SELECTOR = 'body[' + UNRESOLVED + ']';

var style = document.createElement('style');
style.textContent = UNRESOLVED_SELECTOR + ' { ' +
'opacity: 0; display: block; overflow: hidden; } \n';
style.textContent = ''
+ 'body {'
+ 'transition: opacity ease-in 0.2s;'
+ ' } \n'
+ 'body[unresolved] {'
+ 'opacity: 0; display: block; overflow: hidden;'
+ ' } \n'
;
var head = document.querySelector('head');
head.insertBefore(style, head.firstChild);

Expand Down

0 comments on commit ea2ff2d

Please sign in to comment.