I''m trying to fire the click event of my parent node. This is for asp.net backwards compability. Right now I have if(parentcontrol.fire) { parentcontrol.fire(''click''); // __doPostBack(convertID(parentcontrol.id)); } This will not dispatch and click my parent. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Element#fire will not dispatch "native" events, as cross browser compatibility for that is crap. The best you can do is to fire a custom event on click, and trigger the same event with fire. element.observe("click", function() { this.fire("dom:clicked") }); element.observe("dom:clicked", function(event) { // implement your click event logic here }); element.fire("dom:clicked"); Best, -Nicolas On Jan 10, 2008 9:17 PM, Michael <89iroc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I''m trying to fire the click event of my parent node. This is for > asp.net backwards compability. Right now I have > > if(parentcontrol.fire) > { > > > parentcontrol.fire(''click''); > // __doPostBack(convertID(parentcontrol.id)); > } > > This will not dispatch and click my parent. > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Jan 11, 9:17 am, Michael <89i...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m trying to fire the click event of my parent node. This is for > asp.net backwards compability. Right now I haveHow does the server technology affect how you do this?> > if(parentcontrol.fire) > { > parentcontrol.fire(''click'');Have you considered: if (parentcontrol.onclick) { parentcontrol.onclick();} which doesn''t simulate a click, but there is no reasonable cross- browser way of doing that anyway (see below).> // __doPostBack(convertID(parentcontrol.id)); > } > > This will not dispatch and click my parent.Dispatching events is another story - there''s IE''s fireEvent and the W3C dispatchEvent, both will bubble and fire other hanlders, but triggering default actions associated with the elements is mostly not supported. e.g. dispatching a click event to a link does not cause the link to be followed, however sending a click to a sumbit button submits the form in Firefox (dispatchEvent) but not in IE (fireEvent). -- Rob --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
I think I am going to start extending "fire" to fire dom events. It doesnt make sense to me that prototype abstracts the dom in every form except firing events. If element.observe can wire dom events then element.fire should fire them. The only thing I can think of that this isnt done is that no one has done it yet. On Jan 10, 7:59 pm, RobG <rg...-AFFH1GffN5hPR4JQBCEnsQ@public.gmane.org> wrote:> On Jan 11, 9:17 am, Michael <89i...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I''m trying to fire the click event of my parent node. This is for > > asp.net backwards compability. Right now I have > > How does the server technology affect how you do this? > > > > > if(parentcontrol.fire) > > { > > parentcontrol.fire(''click''); > > Have you considered: > > if (parentcontrol.onclick) { parentcontrol.onclick();} > > which doesn''t simulate a click, but there is no reasonable cross- > browser way of doing that anyway (see below). > > > // __doPostBack(convertID(parentcontrol.id)); > > } > > > This will not dispatch and click my parent. > > Dispatching events is another story - there''s IE''s fireEvent and the > W3C dispatchEvent, both will bubble and fire other hanlders, but > triggering default actions associated with the elements is mostly not > supported. > > e.g. dispatching a click event to a link does not cause the link to be > followed, however sending a click to a sumbit button submits the form > in Firefox (dispatchEvent) but not in IE (fireEvent). > > -- > Rob--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Jan 11, 4:37 pm, Michael <89i...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I think I am going to start extending "fire" to fire dom events. It > doesnt make sense to me that prototype abstracts the dom in every form > except firing events. If element.observe can wire dom events then > element.fire should fire them. The only thing I can think of that > this isnt done is that no one has done it yet.Hi, It''s definitely a wanted feature... unfortunately, it''s a mess to get right, as the implementations differ widely across browsers. From the preliminary research I''ve done, firing mouse events is possible in all browsers (but a pain in Safari), I''m totally unsure about keyboard events though. Best, Tobie --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Can we at least get it to fire events wired in with element.observe...Can we at least get it to fire events wired in with element.observe... So element.observe(''click'',function(){ alert(''Hello world''); }); would be fired by element.fire(''click''); If you dont use element.observe then you are on your own but if you used element.observe you are good to go. PS.. Why cant I just reply to these messages in gmail... It keeps saying its blocked. On Jan 11, 11:09 am, Tobie Langel <tobie.lan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Jan 11, 4:37 pm, Michael <89i...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I think I am going to start extending "fire" to fire dom events. It > > doesnt make sense to me that prototype abstracts the dom in every form > > except firing events. If element.observe can wire dom events then > > element.fire should fire them. The only thing I can think of that > > this isnt done is that no one has done it yet. > > Hi, > > It''s definitely a wanted feature... unfortunately, it''s a mess to get > right, as the implementations differ widely across browsers. > > From the preliminary research I''ve done, firing mouse events is > possible in all browsers (but a pain in Safari), I''m totally unsure > about keyboard events though. > > Best, > > Tobie--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---