[development] control javascript behaviors order

Gábor Hojtsy gabor at hojtsy.hu
Sat Mar 8 04:49:08 UTC 2008


On Fri, Mar 7, 2008 at 7:23 PM, Jack Bates <ms419 at freezone.co.uk> wrote:
> I have one Drupal 6 JavaScript behavior which must be run before another
>  behavior, however the JavaScripts which set `drupal.behaviors.x` are
>  included in the page in the opposite order. Consequently the behaviors
>  are called in the wrong order.
>
>  I did a little googling and read the section of drupal.js responsible
>  for calling behaviors, but haven't found any techniques for controlling
>  the order of behaviors. Do any techniques for controlling the order of
>  behaviors currently exist, or are any planned?

There are some "hacks" in Drupal 6 around textarea resizing and
teasers to ensure proper ordering, basically calling out to the
behavior to run first, if the second one finds out (by looking for a
class) that the first did not run yet.

Gabor


More information about the development mailing list