I’m having an issue with LABjs. I load all my scripts, but when I use it in IE it completely breaks down.
$LAB
.script('https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js').wait()
.script('https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js')
And if I add a conditional statement
<!--[if IE ]>
<script type="text/javascript" src="somescript.js"></script>
<![endif]-->
This would fail. How would I include this into LABjs?
Thanks.
I would first STRONGLY say, you shouldn’t be doing IE-only scripts any more. But if you really absolutely must, and after you slap yourself on the wrist several times for that bad practice…
The
ie_versionsnippet of code comes from: http://james.padolsey.com/javascript/detect-ie-in-js-using-conditional-comments/ which uses dynamically created IE conditional comments to determine an IE version.NOTE: I’m assuming that “somescript.js” needs to be executed strictly after the jquery and jquery-ui scripts, based on what you posted. If that’s not the case, you could put it in a different position in the
$LABchain if you wanted to, and you could take out thesetOptions({AlwaysPreserveOrder:true})and instead usewait()in the chain only where desired/necessary.