Update drupal 6-dev to jquery 1.1.4
mfer - August 24, 2007 - 18:19
| Project: | Drupal |
| Version: | 6.x-dev |
| Component: | javascript |
| Category: | task |
| Priority: | critical |
| Assigned: | dmitrig01 |
| Status: | closed |
Description
jQuery 1.1.4 was just released. See: http://jquery.com/blog/2007/08/24/jquery-114-faster-more-tests-ready-for...
Is it time to update? For the speed improvements alone I'd like to see the update.

#1
It shouldn't be too hard. 1.1.3 is already in and if 1.1.4 doesn't break anything major, it should just drop in. The speed improvements are into the double digits, BIG improvements over 1.1.3 and even more so that 1.1.2! I'm stoked at the animation possibilities.
#2
I patched jquery.js 1.1.3.1 to 1.1.4 in HEAD. It seems to work fine since all the hard work was fixed for 1.1.3.1 earlier. I need more testers to see if this patch didn't break other modules....
#3
Changing status to patch review...
#4
FYI: I submitted an earlier issue for upgrading the latest Drupal-dev to jquery 1.1.4 that has some reference links to the previous Drupal 6 upgrade to jQuery 1.1.3.1.
Also, these the degraded functions with jQuery 1.1.4 that I've summarized from the official release announcement:
Deprecated Selectors
$(”div//p”) XPath Descendant Selector -- replaced with CSS: $(”div p”)
$(”div/p”) XPath Child Selector -- replaced with CSS: $(”div > p”)
$(”p/../div”) XPath Parent Selector -- replaced with: $(”p”).parent(”div”)
$(”div[p]”) XPath Contains Predicate Selector -- replaced with: $(”div:has(p)”)
$(”a[@href]”) XPath Attribute Selector -- replaced with CSS: $(”a[href]”)
Deprecated DOM Manipulation
$(”div”).clone(false) -- replaced with: $(”div”).clone().empty()
Deprecated DOM Traversal
$(”div”).eq(0) -- replaced with either: $("div").slice(0,1); -- $("div:eq(0)") -- $("div:first")
$(”div”).lt(2) -- replaced with either: $("div").slice(0,2); -- $("div:lt(2)")
$(”div”).gt(2) -- replaced with either: $("div").slice(3); -- $("div:gt(2)")
Deprecated Ajax functions
$(”#elem”).loadIfModified(”some.php”) -- replaced with: $.ajax({url: "some.php", ifModified: true, success: function(html){$("#elem").html(html);}});
$.getIfModified(”some.php”) -- replaced with: $.ajax({url: "some.php", ifModified: true});
$.ajaxTimeout(3000) -- replaced with: $.ajaxSetup({timeout: 3000});
$(…).evalScripts() -- is no longer needed at all
It'd be good to go through the Drupal javascript code and replace any deprecated methods with the suggested replacements -- if any instances exist.
One final note is that John Resig said here that he is taking the week off this week to try to get jQuery 1.2 out the door by September 3rd.
The deprecated functions listed above in 1.1.4 are in preparation for the 1.2 release, and so if there are no problems with upgrading to 1.1.4, then we should consider extending this issue to upgrade to 1.2 as soon as it is released.
#5
No reason to wait. 1.1.4 is less invasive than 1.2 will be. More testing will be needed for that version.
I did a massive grep against the HEAD D6 JS files in /modules and /misc I didn't find any of the deprecated JS you mentioned above.
None of the JS code uses XPath. The rest came up empty in my search.
Joe
#6
Deprecated Selectors
$(”div//p”) XPath Descendant Selector -- replaced with CSS: $(”div p”)
$(”div/p”) XPath Child Selector -- replaced with CSS: $(”div > p”)
$(”p/../div”) XPath Parent Selector -- replaced with: $(”p”).parent(”div”)
$(”div[p]”) XPath Contains Predicate Selector -- replaced with: $(”div:has(p)”)
Used by:
none
$(”a[@href]”) XPath Attribute Selector -- replaced with CSS: $(”a[href]”)
Used by:
./modules/book/book.js
./modules/comment/comment.js
./modules/node/node.js
./modules/user/user.js
Deprecated DOM Manipulation
$(”div”).clone(false) -- replaced with: $(”div”).clone().empty()
Used By:
none
Deprecated DOM Traversal
$(”div”).eq(0) -- replaced with either: $("div").slice(0,1); -- $("div:eq(0)") -- $("div:first")
$(”div”).lt(2) -- replaced with either: $("div").slice(0,2); -- $("div:lt(2)")
$(”div”).gt(2) -- replaced with either: $("div").slice(3); -- $("div:gt(2)")
Used by:
none
Deprecated Ajax functions
$(”#elem”).loadIfModified(”some.php”) -- replaced with: $.ajax({url: "some.php", ifModified: true, success: function(html){$("#elem").html(html);}});
$.getIfModified(”some.php”) -- replaced with: $.ajax({url: "some.php", ifModified: true});
$.ajaxTimeout(3000) -- replaced with: $.ajaxSetup({timeout: 3000});
$(…).evalScripts() -- is no longer needed at all
Used by:
none
#7
Good catch dmitri. I did some testing and removed the @ Xpath selectors from [@ using the instances you stated. In user.js, the Pictures support radio fails to expand if I remove the @ from the selector in line #184...
$('div.user-admin-picture-radios input[@type=radio]:
It maybe deprecated but it still works as is. I would surmise that that rest of the other @ instances are the same. We should leave them untouched. Can anyone else confirm? If this is true, my patch still stands.
#8
This patch makes Drupal 6 compatible with other JavaScript libraries, upgrades it to 1.1.4, and it uses less DOM and more jQuery.
#9
b0rked autocomplete, fixed now
#10
Do you have Firebug installed dmitri? I patched my virgin D6 with your http://drupal.org/files/issues/jquery_1131_to_114_1.patch patch and I'm getting JS errors all over the place in FF2.
Drupal is not defined
[Break on this error] Drupal.behaviors.password = function(context) {
user.js (line 8)
Drupal is not defined
[Break on this error] Drupal.behaviors.textarea = function(context) {
textarea.js (line 4)
Drupal is not defined
[Break on this error] Drupal.toggleFieldset = function(fieldset) {
collapse.js (line 7)
#11
:x. I'm in the middle of working ATM, but I'll look into it soon. BTW, I forgot to say untested!
#12
subscribing..
#13
We had an issue to make this compatible with other libraries and there was some debate there. (Although closed with a reference to this issue). I don't think that basically moving the two things together is the best idea... These are also heavy changes, for which we are more and more late in the release cycle.
(Yes, I know every new jQuery release is mind-blowingly cool).
#14
If dmitrig01 can fix his bugs and demonstrate that his changes don't break any of the other scripts, I'm all for going with his patch. Otherwise, I'd say stick to my patch which was less-invasive and much safer to use.
#15
Folks please test http://drupal.org/node/170224#comment-294457 ie. #2 -- dmitri's patch is for D7 I would say.
#16
Changing the title back to the original intention of the thread which was to upgrade Drupal 6 up to the latest jQuery 1.1.4.
@GáborHojtsy: Upgrading to jQuery 1.1.4 shouldn't take a lot of heavy changes.
I agree w/ Gabor & chx that making jQuery compatible w/ other javascript libraries should be held off until D7 & that was a feature creep of this thread.
Most of the heavy lifting to get to 1.1.3.1 was done here, and upgrading to 1.1.4 should be more straight forward.
The Drupal javascript already looks pretty cleaned up in terms of the deprecated functions in jQuery 1.1.4 -- according to dmitrig01's audit there are only four Drupal core *.js files that use the deprecated XPath Attribute Selector of $("a[@href]") -- book.js, comment.js, node.js & user.js
We should double check that all "@" XPath selectors are indeed deprecated, and then replace them w/ them the CSS method (i.e. simply removing the "@").
FYI: There isn't any other deprecated functionality w/ jQuery 1.2, which should be coming out next week or soon thereafter. So any changes for 1.1.4 will get us ready to plug in 1.2
#17
This is based on patch #2 and Dmitrig's findings. I did a quick double check of the depricated selectors and everything else. Nothing else was found.
This is really an easy drop in. I tested in FF2/Safari2/IE6/Opera9.. Checked for js errors and I found none.
#18
This is broken. As I said in #7, user picture radio is broken when you remove the @ sign in user.js. Please test.
#19
Hrm, okay.. See this post by Resig.
http://jquery.com/blog/2007/08/24/jquery-114-faster-more-tests-ready-for...
So, forget the deprecated selectors. momendo, you had the right idea. The "@" is back in and won't make sense until later versions.
btw, momendo, you have to diff from root.
#20
wwebernet and Bdragon mentioned the $Date$ and or $Rev$ tags could interfere when commited. So, here it is again without the $ signs.
#21
I tested the following in FF2 and found no problems or JS bugs.
- expanding grab boxes
- color picker in garland theme
- expanding/collapsing arrows
- autoselecting radios
- expanding user.js radio
- summary splitter in content
- checkall boxes
- user text field lookup checker
Can't test...
- Auto info cookie store in comment - submit has broken php/mysql
#22
Same tests as above on IE7, Opera 9.23 and Safari 3.0.3 for Windows on Vista Ultimate 64bit. No bugs found regarding the JS.
#23
Tested with Safari 3b/Safari 2/FF2 and Opera 9 on a Mac..
Works as expected.. this is ready!
#24
Glad to see it such an easy drop in. Committed to CVS HEAD.
#25
Just wanted to bump this thread again to point out that jQuery 1.2 has been released, and a new thread has been started to upgrade jQuery again here:
http://drupal.org/node/174708
#26