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.
This is not showing up in core as an error, but if the Array prototype has been added to, this will cause the iterating code to run over properties (and methods) of the Array, as opposed to just the elements. It's bad form in JavaScript to use the for...in construct when working with arrays (should only be used for objects).
Comment | File | Size | Author |
---|---|---|---|
#10 | tabledrag_iterator-800968-d6-10.patch | 578 bytes | Albert Volkman |
#7 | tabledrag-for-800968-7.patch.txt | 511 bytes | Big Z |
#2 | 800968_tabledrag-for_2.patch | 551 bytes | ksenzee |
#1 | tabledrag_iterator.patch | 1.34 KB | JacobSingh |
tabledrag_iterator.patch | 3.44 KB | JacobSingh | |
Comments
Comment #1
JacobSingh CreditAttribution: JacobSingh commentedOops, snuck some extra changes in there.
Comment #2
ksenzeeA simpler fix is just to construct the for loop correctly.
Comment #3
ksenzeeGuess I should retitle the issue, too.
Comment #4
Damien Tournoud CreditAttribution: Damien Tournoud commentedYep. Better Javascript!
Comment #5
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks.
Comment #7
Big Z CreditAttribution: Big Z commentedCould this please be back ported to the 6.x branch. Patch attached.
Many thanks!
Comment #8
ptaff CreditAttribution: ptaff commentedsubscribe
Comment #9
mstrelan CreditAttribution: mstrelan commented+1 for backport to D6
Comment #10
Albert Volkman CreditAttribution: Albert Volkman commentedRe-posting patch from #7. No credit please!
Comment #11
buddaSuper, perfect fix for my ageing Drupal 6 site.
At present its preventing admin forms from working in Chrome so a bit more than a 'minor' issue I think.
The bug is also not just in the block.module - it also affects the taxonomy admin, webform field designer, CCK field editor etc.
Comment #12
Gábor HojtsyLooks good. Thanks, committed, pushed.
Comment #14
j0rd CreditAttribution: j0rd commentedI usually check the patches before I update my Drupal and I ran across this issue and fix.
I would recommend taking it one step further and look at reducing the number of gratuitous .length calls with the hopes of improving the speed of tabledrag.js further. From my simple test (profiling patch included in issue), it could reduce the number of calls to .length from ~30,000+ to roughly 450 for a single drag.
Take a look
#1571814: tableDrag.js, reduce the number of calls of .length from 33478 to 455