WordPress.org

Support

Support » Plugins and Hacks » Jetpack by WordPress.com » [Resolved] Spinner conflict

[Resolved] Spinner conflict

  • 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/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jeremy Herve

    @jeherve

    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?

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

    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

    Plugin Author Jeremy Herve

    @jeherve

    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

    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

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] Spinner conflict’ is closed to new replies.
Skip to toolbar