Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
jQuery Update currently operates by removing existing scripts and appending its replacements to the end of the list. This may break other scripts that rely on a properly initialized environment, that is, the load order of scripts. The attached patch solves this problem by properly exchanging scripts without touching the order. As a side effect, the special handling for jquery.js is also removed.
Comment | File | Size | Author |
---|---|---|---|
#1 | 858578-jquery_update.patch | 3.67 KB | smk-ka |
Comments
Comment #1
smk-ka CreditAttribution: smk-ka commentedComment #2
froboyApplied this patch and everything seems to work just fine and dandy. Thanks!
Comment #3
mfer CreditAttribution: mfer commentedThis looks nice. Let me take a look at it.
Comment #4
sunIs there a reason for why we are building a new array and merging that later on into $scripts, instead of directly altering the existing $scripts array entries? If so, we should document that. If not, then directly manipulating the existing $scripts would be more safe.
Powered by Dreditor.
Comment #5
smk-ka CreditAttribution: smk-ka commentedThis is what JU currently does: since $scripts is keyed by file name, it unsets the old key and appends the new one, which changes the order. The new script creates a copy exactly for the reason to retain the order. The only way to manipulate $scripts directly would be using array_splice(). Looking at its syntax makes me believe the result won't be more readable, though.
Comment #6
sunAh, I see it now, sorry - only in D7, drupal_get_js() is using the array values and ignoring the keys entirely.
...which makes this RTBC, although I didn't test myself, but I'm sure you did -- unless mfer still wants to have a look at it, too?
Comment #7
markhalliwellDrupal 6 reached EOL (end-of-life) on February 24, 2016.