OpenF2 / F2

Redefining web integration for the financial services community
Apache License 2.0
129 stars 62 forks source link

Flash of Unstyled Content #83

Open qrider opened 11 years ago

qrider commented 11 years ago

Looks like there is no mechanism determining when the style sheets are loaded which has the potential of showing unstyled content on slow file loads. Currently we are experiencing this issue when going through a client proxy/relay.

I think this can be solved by providing an onload event for each stylesheet. https://developer.mozilla.org/en-US/docs/HTML/Element/link#Stylesheet_load_events

ilinkuo commented 11 years ago

A possible future solution, should F2 adopt AMD as its loading mechanism, would be to use the stylesheet as a dynamic AMD dependency to ensure that it is loaded before F2 renders....

require(["css!yourStyleSheet.css",..], function(){
   .... F2.renderApp();
})
brianbaker commented 11 years ago

Need to keep an eye on browser compatibility for something like this and how it relates to F2's browser compatibility.

markhealey commented 11 years ago

According to the YepNope site, CSS callbacks were removed recently in favor of the official plugin.

ilinkuo commented 11 years ago

This might be useful -- http://www.phpied.com/when-is-a-stylesheet-really-loaded/