WordPress.org

Ready to get started?Download WordPress

Forums

Jetpack by WordPress.com
[resolved] Spinner conflict (6 posts)

  1. jeremyBass
    Member
    Posted 1 year ago #

    Hello,
    There is I believe a JavaScript namespace conflict it seems when the user admin nav is shown and jquery ui. It seems that I can't load jquery ui cause it has the spinner plugin in it, which I do use too in the non wp side of my site. So the issue is that I get is

    SCRIPT87: Invalid argument.
    spin.js?ver=1.2.4, line 43 character 3

    which is

    return el.sheet || el.styleSheet;

    and then

    SCRIPT5009: 'Spinner' is undefined
    jquery.spin.js?ver=3.5.1, line 27 character 3

    which is

    if ( Spinner )

    both from the jetpack _inc folder. So if a use logs in then the nav bar is loaded but then JavaScript crashes since there is a conflict. Log out and since the jetpack code there for the bar is not fired all is well.

    Seems that the IE fallback is not working in IE? Can there be a change in namespace or something done to prevent jquery ui and this CSS3 shim from interfering?

    Any ideas?
    Cheers - Jeremy

    http://wordpress.org/extend/plugins/jetpack/

  2. Jeremy Herve
    Happiness Engineer
    Plugin Author

    Posted 1 year ago #

    Thanks for the report!

    Could you try to enqueue your Spin library with wp_enqueue_script, like so?

    function my_scripts_method() {
    	wp_enqueue_script(
    		'spin',
    		get_template_directory_uri() . '/js/spin.js'
    	);
    }
    add_action( 'wp_enqueue_scripts', 'my_scripts_method' );

    Source

    This way, only one of the libraries will be loaded, and that should solve any conflicts between Jetpack and your plugin.

    If that doesn't help, could you post your site URL, so I can have a look?

  3. jeremyBass
    Member
    Posted 1 year ago #

    Sure thing. I'll give it a go, check it out and report back later today. cheers

  4. jeremyBass
    Member
    Posted 1 year ago #

    Hello, that seems to do the trick. Question, since jquery ui is a plugin that is much higher on the list of used jquery plugins, maybe there could just be a rename so that the conflict is permanently resolved?

    Regardless thanks for the help.
    Cheers -Jeremy

  5. Jeremy Herve
    Happiness Engineer
    Plugin Author

    Posted 1 year ago #

    If you use wp_enqueue_script for all your javascript libraries, you should be able to avoid all conflicts with Jetpack and other plugins using jQuery UI and other libraries.

    You can read more about Javascript dependencies in WordPress here:
    http://codex.wordpress.org/Function_Reference/wp_enqueue_script

  6. jeremyBass
    Member
    Posted 1 year ago #

    Well I'll To be honest I'm not a fan of that approve to over come a IE css3 shim over a main stream 100x more usage plugin such as jQuery Ui, but i get what you mean.

    Thanks for the help
    Cheers -Jeremy

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.