Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
#315798: JavaScript Patch #2: Weight added weights to drupal_add_js() included files, but now files of the same weight can be included in a different order then the order of the calls. This is counter intuitive and we need to fix that.
Comment | File | Size | Author |
---|---|---|---|
#5 | 505528.patch | 3.15 KB | RobLoach |
#1 | 505528-js-files-wrong-order.patch | 886 bytes | Damien Tournoud |
Comments
Comment #1
Damien Tournoud CreditAttribution: Damien Tournoud commentedAnd here is a patch.
Of course, we need a test... anyone?
Comment #2
TheRec CreditAttribution: TheRec commentedTest, it works as advertised. I used the tests described in #315798: JavaScript Patch #2: Weight by Rob Loach (comment #6)..
Alerts are showing in this order :
Which is the expected order. I guess we do not need to test all the other scopes and types since they use the same logic for weight, but if needed just ask and maybe give samples of what should be tested ?
Comment #3
RobLoachThanks DamZ! Good find.
Comment #4
webchickTests, please!
Comment #5
RobLoachRegex FTW.
Comment #6
Damien Tournoud CreditAttribution: Damien Tournoud commentedDeal.
Comment #7
webchickThanks, committed to HEAD!
Comment #9
donquixote CreditAttribution: donquixote commentedThe micro-weight does not work in some cases.
Follow-up in
#1670450: drupal_get_js() stable sort / drupal_add_js automatic weight