Thanks kangax.

I'm only supporting Firefox, so IE incompatibility isn't an issue :D

I'd tried something with custom events and .fire(), but I couldn't
figure out how to use that to fire the "mouseup" event, which is the
one I need. Are you suggesting that there's some way to replace the
mouseup event with a custom event?

Thanks again,
Ian

On Mon, Jun 16, 2008 at 1:07 PM, kangax <[EMAIL PROTECTED]> wrote:
>
> I believe that dispatchEvent accepts a manually instantiated event
> only. Moreover, this won't work in IE, which follows (surprise!) its
> own standard (fireEvent). It looks like one of the solutions would be
> to work with custom events, as they allow for a more flexibility.
>
> - kangax
>
> On Jun 16, 2:28 pm, "I. E. Smith-Heisters" <[EMAIL PROTECTED]> wrote:
>> Hi all,
>>
>> I'm doing a drag-proxy like this:
>>
>> ---
>>     this.element = element;
>>
>>     this._proxy = this.element.cloneNode(true);
>>     this._proxy.absolutize();
>>     this._proxy.style.opacity = 0.7;
>>     this._proxy.clonePosition(element);
>>
>>     this._proxy.observe('mouseup', this.destroy.bind(this));
>>     this.element.observe('mouseup', this.destroy.bind(this));
>>
>>     document.body.appendChild(this._proxy);
>>     new Draggable(this._proxy).initDrag(ev);
>> ---
>>
>> which is necessary so that the draggable is rendered as a child of
>> document.body and therefore can float over scrollable divs.
>>
>> However, now the proxy captures mouseup events, which nullifies the
>> original element's click and doubleclick events (probably not the best
>> idea to have mousdown, up, click, and doubleclick all on one element,
>> but oh well). So I want to route event bubbling from the proxy to the
>> parent, but keep the proxy a child of document.body. I think I only
>> really need to route mouseup. So I tried this:
>>
>> ---
>>     this._proxy.observe('mouseup', function(ev)
>> {this.element.dispatchEvent(ev);}.bind(this));
>> ---
>>
>> but that throws this error, which is rather incomprehensible:
>>
>> ---
>> [Exception... "Component returned failure code: 0x80070057
>> (NS_ERROR_ILLEGAL_VALUE) [nsIDOMEventTarget.dispatchEvent]" nsresult:
>> "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame 
>> ::http://localhost:3000/javascripts/behaviors.js?1211228591::
>> anonymous :: line 12" data: no]
>> ---
>>
>> Can anyone please shed some light on how to approach this problem?
>>
>> Thanks,
>> Ian
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to