Help with jQuery.event.trigger

Help with jQuery.event.trigger


I'm posting this to the dev list in hopes that someone here may know of a
better pattern for what I'm trying to do. A change with the
jQuery.event.trigger method (between 1.2.x and 1.3.x) has affected a plugin
I wrote, and I'm trying to find a solution.
----------------------------------------
I have a custom color picker which has broken since I upgraded from 1.2.6 to
1.3.2.
I've traced the problem to a change in how events are bubbled. There's
probably an easy fix, but I'm not sure what it would be.
I have a hue slider with a hue indicator inside it. The indicator is a
draggable, and the hue updates on drag. That works fine.
The slider itself has a mousedown event that moves the hue indicator the
clicked position. This also works fine.
The slider (parent) mousedown event then triggers the indicator (child)
mousedown event. This is what is broken. What I'm trying to do, is when
the user does a mousedown on the slider, I want the indicator to not only
move to that position, but be draggable immediately without having to
release the mouse and click on the same spot.
The specific problem is this:
1. The slider triggers the mousedown event on the indicator.
2. The indicator draggable initializes.
3. The indicator's mousedown.draggable event does not cancel propagation.
4. The jQuery trigger event then bubbles up to the parent (the slider).
5. Which then re-fires the indicator mousedown event.
6. Infinite loop.
It seems that there must be a better pattern that allows me to trigger the
child element's draggable without causing this loop.
Does anyone have any suggestions?
JK