• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed Upgrade jQuery

digitalpoint

Well-known member
#1
I know upgrading jQuery within XenForo is on the to-do list at some point, but figured I would make an "official" report so it doesn't get forgotten...

jQuery versions less than 1.7.0 utilize event.layerX and event.layerY, so now we end up with deprecated notices in Chrome on every page view in XenForo due to the old version of jQuery:
Code:
event.layerX and event.layerY are broken and deprecated in WebKit. They will be removed from the engine in the near future.
It was fixed in jQuery 1.7.0: http://bugs.jquery.com/ticket/10531

The jQuery Tools that XenForo uses has been "officially" updated to support jQuery 1.6.4, but I've been running it on some stuff with jQuery 1.7.1 without any problems.
 

Mike

XenForo developer
Staff member
#4
I wish xenForo would make it easier for us to choose what version of jQuery we want to run without making code edits.
The reason that we don't upgrade jQuery instantly is that every time does require code edits to fix the BC breaks -- we have a lot of stuff built on top of it.
 

digitalpoint

Well-known member
#6
It's not practical to auto-update... sometimes there are incompatible changes. For example when 1.6.0 added the prop() function, and made some of the old attr() not function the same any longer.

Auto-updating jQuery on a commercial product that simply could break because of the new version of jQuery would be a support nightmare.

That being said, jQuery is pretty good about maintaining backward compatibility... the only thing I've ever personally had to "fix" after updating to the newest version was when prop() was introduced in 1.6.0.
 

Adam Howard

Well-known member
#11
Just use Google CDN to get the latest.
Google CDN will only pull 1.5.2 because it is hard coded inside XenForo

The last time I tried to use a newer version... TinyMCE (the editor) and a few other things... Didn't like it.

XenForo seems to have far to many build in dependences. This is something I don't understand because I could change this in vBulletin, phpBB, WordPress, SMF, and even dare I say it... IPB. Yet XenForo has this so coded in that adding another jQuery version, screws things up.

BUT if you want to try to do it....

/library/XenForo/Application.php

PHP:
public static $jQueryVersion = '1.5.2';
IF you're doing a local hosting, you need to upload the current version to

/js/jquery
 

digitalpoint

Well-known member
#12
The version of jQuery Tools that XF is using doesn't work with the newer versions of jQuery. So jQuery Tools would need to be updated as well... and the new version isn't a drop-in replacement (I tried).
 

Adam Howard

Well-known member
#13
The version of jQuery Tools that XF is using doesn't work with the newer versions of jQuery. So jQuery Tools would need to be updated as well... and the new version isn't a drop-in replacement (I tried).
Current version of jQuery Tools still recommends jQuery 1.7.2, but that has an issue with TinyMCE any ways (see TinyMCE's website).

As I said... To many version dependences built in.
 

digitalpoint

Well-known member
#14
Yeah, but XF doesn't use the current version of jQuery Tools, they are using one that required jQuery 1.5.x (breaks with jQuery 1.6+). Which of course was the current version when they added it to XenForo, so not like they added an old version at the time.

And considering jQuery 1.8 just came out yesterday (I think), the newest jQuery Tools might work with it... probably haven't even had time to test it yet.
 

Adam Howard

Well-known member
#15
Yeah, but XF doesn't use the current version of jQuery Tools, they are using one that required jQuery 1.5.x (breaks with jQuery 1.6+). Which of course was the current version when they added it to XenForo, so not like they added an old version at the time.

And considering jQuery 1.8 just came out yesterday (I think), the newest jQuery Tools might work with it... probably haven't even had time to test it yet.
I'll bite....

..... Where is the jQuery Tools in XenForo?
 

NeoCHI

Active member
#18
So is there no way to use a newer jquery?

I'm trying to make a simple image slider that's touch enabled but it seems like its only availabe in jquery 1.7 + ... anyone know of any other options?
 

tyteen4a03

Well-known member
#20
jQuery 2.0 beta-2 Released

Since jQuery 2 is well on its way, it may be best to wait a little longer and implement that.
There is a problem with that though: jQuery 2 does not support IE8 or lower. Currently IE8 is still used widely.
1.9 and 2 shares the same API, so we can upgrade to 1.9 and when IE8 goes past advertised lifetime (the whole IE series is past its lifetime anyways) we can upgrade to the 2.x series.