jupiterjs/steal — Issue #49: steal 3.2.1: exception with steal.loaded property set in IE8/IE9
Author: skhilko
Created: 2011-10-19 19:39:18+00:00
State: open

I'm using jmvc 3.2.1 and attempting to reduce page flickering during its initialization. So I've added production.css to the head element and provided `loaded` property in steal global var:

<link rel="stylesheet" type="text/css" href="production.css"/>
<script type="text/javascript">
var steal = {
app: "myapp",
env: "production",
loaded: ["myapp/production.css"]
};
</script>
<script type='text/javascript' src='../steal/steal.js'></script>

I'm getting an exception in IE browsers and production.css is loaded by steal for the second time.
Other browsers work fine and `production.css` is requested only once in the head.

After some research I've found why IE is failing..
There is a section of a special IE treatment in steal.js
it starts with if (support.interactive) { where the function below
` function(name){
var src = steals[name].options.src,
interactive = getCachedInteractiveScript(),
interactiveSrc = interactive.src;
interactives[src] = interactives[interactiveSrc];
interactives[interactiveSrc] = null;
}
`
is being attached on steal.loaded function.
This particular function fails on var src = steals[name].options.src line because steals["myapp/production.css"] is undefined here.
Other browsers have no issue here because an original steal.loaded is called directly.