WordPress.org

Ready to get started?Download WordPress

Forums

Use Google Libraries
[resolved] jQuery entries in the source code (2 posts)

  1. GermanKiwi
    Member
    Posted 7 months ago #

    Hi Jason,

    I've just installed your plugin for the first time, in order to replace the WordPress jquery and jquery-ui links with the Google equivalents - seems to be working great so far!

    I have a couple of questions for you:

    1) In addition to changing the link URLs in the <head> section, the plugin also added this line:

    <script type='text/javascript'>try{jQuery.noConflict();}catch(e){};</script>

    Can you explain what this is for or what it does?

    2) Before installing your plugin, my site had the following line at the very end of the source code, just before the closing </body> tag - along with a few other lines for CSS and JS files from my theme and from some other plugins:

    <script type='text/javascript' src='http://www.ibcstuttgart.de/wp/wp-includes/js/jquery/ui/jquery.ui.core.min.js?ver=1.10.3'></script>

    But your plugin has moved this line to the top, into the <head> section:

    <script type='text/javascript' src='//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js'></script>

    I'm wondering why this is? I imagine there must be a good reason why the jquery-ui file is originally at the very end and not in the head section. Wouldn't it be better if your plugin leaves it in the same location as it originally is?

    Cheers!

    http://wordpress.org/plugins/use-google-libraries/

  2. Jason Penney
    Member
    Plugin Author

    Posted 4 months ago #

    The extra script tag are to keep thing compatable with WordPress core. The jquery.js provided by WordPress has been modified to end with jQuery.noConflict(), so this does it's best to ensure you get the same result when pulling jQuery from google.

    My plugin is not changing where it's loading (or it shouldn't be), but the WordPress script loader is. Note that jQuery-UI when coming from Google is a single file, and from WordPress it's a bunch of small files. Same content, but the browser performance is better when it's one file. There's a chance this difference is interacting with some prerequisite of some other script, causing the script loader to determine it should load in the header.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.