Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Enable jQuery noConflict #160

Merged
merged 1 commit into from
Aug 30, 2016
Merged

Enable jQuery noConflict #160

merged 1 commit into from
Aug 30, 2016

Conversation

retlehs
Copy link
Member

@retlehs retlehs commented Aug 26, 2016

this enables jQuery.noConflict(); just like WP does ¯_(ツ)_/¯

ref #155

@retlehs retlehs force-pushed the jquery-no-conflict branch from 9d00abe to 7cce2b5 Compare August 30, 2016 16:29
@retlehs retlehs merged commit 3843e80 into master Aug 30, 2016
@retlehs retlehs deleted the jquery-no-conflict branch August 30, 2016 17:27
@timcv
Copy link

timcv commented Sep 21, 2016

Would it be possible to make this optional? We are using soil on alot of sites and the update craches our js.

Kind regards

Tim

@retlehs
Copy link
Member Author

retlehs commented Sep 21, 2016

what does "crashes our js" mean exactly

Sent from my iPhone

On Sep 21, 2016, at 12:54 AM, Tim Samuelsson notifications@github.com wrote:

Would it be possible to make this optional? We are using soil on alot of sites and the update craches our js.


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub, or mute the thread.

@timcv
Copy link

timcv commented Sep 21, 2016

All our js is written without the no conflict mode witch mean that it wount work because we use $ everywhere.

@retlehs
Copy link
Member Author

retlehs commented Sep 21, 2016

So you wrote your JavaScript in a way that it shouldn't have been written. Fix your JS or use a previous version of the plugin.

Sent from my iPhone

On Sep 21, 2016, at 8:34 AM, Tim Samuelsson notifications@github.com wrote:

All our js is written without the no conflict mode witch mean that it wount work because we use $ everywhere.


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub, or mute the thread.

@timcv
Copy link

timcv commented Dec 12, 2016

Hi,

Sorry for a late answer.
Could you explain to me why its wrong to use jQuery without the no conflict mode.

I would be super happy if this could be a setting like define('ROOTS_JQUERY_FALLBACK_NO_CONFLICT, false) or similar.

//Tim

@QWp6t
Copy link
Member

QWp6t commented Dec 12, 2016

WordPress by default uses .noConflict(). We're maintaining parity.

It's trivial to fix your script. Just wrap it in an IIFE.

;(function($) {
  // $() can be used in here...
})(jQuery);

@timcv
Copy link

timcv commented Dec 12, 2016

Thanks, would it work if i wrap my hole js build with that in my gulp job?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants