...

View Full Version : JavaScript Conflicts



_chris
03-19-2012, 09:20 AM
I have been given the task of merging all of the javascript of 3 different websites into one file.

I think that some of the JS is conflicting, but I don't know.
I am not that experienced with JavaScript.

Some of the JS is using jQuery.

I have multiple anonymous jQuery functions:


(function ($) {
// Javascript code
})(jQuery)


Notepad++ tells me there are 7 instances of:

(function (a)

I am guessing there is no doubt that would cause conflict?

What are some common things that cause conflicts in JavaScript?

Philip M
03-19-2012, 11:24 AM
I am guessing there is no doubt that would cause conflict?

What are some common things that cause conflicts in JavaScript?

Duplicate function and/or variable names, and multiple onload statements.
Also using two different Javascript frameworks (say jQuery and Mootools)

All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum