Hacker News new | ask | show | jobs
by zalew 5059 days ago
especially when it's trivial to implement

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
    <script type="text/javascript">
    if (typeof jQuery == 'undefined') { document.write(unescape("%3Cscript src='/path_to_scripts/js/libs/jquery-1.8.0.min.js' type='text/javascript'%3E%3C/script%3E"));}
    </script>
2 comments

Is it really that big of a perf hit to just download the minified and use it in your source like all other libs? jq isn't that big of beast, plus if you have a large site its cached for every other page visit :)
> if you have a large site its cached for every other page visit

until you modify your own js (not that rare and uncommon) and it's back new and shiny again. from the cdn, it's just already there sitting in the browser's cache.

> Is it really that big of a perf hit

maybe not, but if you had the option to wake up with your teeth already brushed, wouldn't you take it? :D

You don't need to use unescape in the fallback

    if(!jQuery)document.write('<script src="jquery.js"></scrip'+'t>');