Jquery and BE.Net conflicts

Topics: Business Logic Layer
Oct 3, 2008 at 4:06 PM
When trying to use JQuery with BE.NET, they both have the $() function defined and this causes a conflict.

I am aware that JQuery can be changed to avoid conflicts with the $() functions (see http://www.dscoduc.com/post/2008/09/24/jQuery-Goodness-for-BlogEngineNET.aspx). The problem I ran into with renaming $() to $j() was that several additional add-ins also failed to work. I took an alternative approach and renamed the BE.NET functions to $b() in blog.js and CommentView.ascx so that JQuery can own the $() function.

Microsoft has announced support for JQuery and that it will ship with Visual Studio (see http://weblogs.asp.net/scottgu/archive/2008/09/28/jquery-and-microsoft.aspx).  

I'm not suggesting BE.NET be dependent on JQuery (because it is a large footprint), but would it be possible to have a future version of BE.Net support JQuery out of the box without conflicts over the $() function?



Oct 4, 2008 at 6:43 AM
Edited Oct 4, 2008 at 6:56 AM
It's pretty trivial to adjust the plugins to handle the name change, however, it would be nice if the default for BlogEngine isn't $()...

Oct 16, 2008 at 8:29 AM
Edited Oct 16, 2008 at 9:41 AM
You can always use  jQuery() instead of $()$0$0or $0$0jQuery.noConflict();
Oct 18, 2008 at 3:04 PM
Edited Oct 18, 2008 at 3:26 PM
I think it's pretty trivial to climb extreme, but many would think otherwise.

For anyone like me who's got better stuff to worry about, the JQuery page on this nastiness is here:
  http://docs.jquery.com/Using_jQuery_with_Other_Libraries
And to make it fly with BE I had to:
 (a) use jQuery() as above (which in any case is more intelligible and hardly difficult to type)
 (b) stick a call to jQuery.noConflict(); in there.

Jan 8, 2009 at 5:04 PM

Well this is very important "stuff to worry about". jQuery is now official in every sense. By both MSFT and Google.
So, I am affraid it is (currently) the standard by which "everyone" has to change and to conform to.
Consequently, next BE will/should be built by using jQuery.

It is as simple as that.

Dusan

PS: tstanley approach is the only way to use jQuery with 1.4.5. I paid a price thinking jQuery.noConflict();  will work. The only difference with my approach was to use the name $BE() ...