Fire and Defer

43 views
Skip to first unread message

kstubs

unread,
Jul 29, 2011, 3:53:17 PM7/29/11
to prototype-s...@googlegroups.com
So is it:

document.fire.defer('load:objects_loading');

- or -

document.fire('load:objects_loading').defer();

kstubs

unread,
Jul 29, 2011, 3:55:44 PM7/29/11
to prototype-s...@googlegroups.com
More on this:

I keep getting stuck in:

function fire(element, eventName, memo, bubble) {
...
    if (document.createEvent)
      element.dispatchEvent(event);      <<<<< STUCK HERE:  object doesn't support dispatchEvent
    else
      element.fireEvent(event.eventType, event);

Miguel Beltran R.

unread,
Jul 29, 2011, 4:05:36 PM7/29/11
to prototype-s...@googlegroups.com
are you using document.fire or Element.fire? because in your other email you said document.fire
Element.fire(element, eventName[, memo[, bubble = true]])

document.fire(eventName[, memo[, bubble = true]])

2011/7/29 kstubs <kst...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group.
To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/aw8Cm8tqkhMJ.

To post to this group, send email to prototype-s...@googlegroups.com.
To unsubscribe from this group, send email to prototype-scripta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.



--
________________________________________
Lo bueno de vivir un dia mas
es saber que nos queda un dia menos de vida

Walter Lee Davis

unread,
Jul 29, 2011, 4:06:25 PM7/29/11
to prototype-s...@googlegroups.com
Try it long-hand:

Element.fire.defer('yourElement','your:event');

I haven't tried it, but that's how delay is invoked. You could also
just do

Element.fire.delay(0,'yourElement','your:event');

which I believe is functionally identical to defer().

Walter

kstubs

unread,
Jul 29, 2011, 4:26:30 PM7/29/11
to prototype-s...@googlegroups.com
OK, with a little confidence, I'll try again.  I am mixing and matching Event and document firing.

kstubs

unread,
Jul 29, 2011, 4:49:44 PM7/29/11
to prototype-s...@googlegroups.com
Tested each of these... winning combination is to use Event static method in this case.  Bother defer and delay work.  So not sure if I have found a bug or not (IE9, regular and compatible modes) so try these out yourself.  These have never been an issue in FF and Chrome.

                //objectLoadingTimer = 
                //document.fire.defer('load:objects_loading');
                //document.fire.delay(0,'load:objects_loading');
                //document.fire('load:objects_loading');
                //Event.fire(document,'load:objects_loading');
                //Event.fire.defer(document,'load:objects_loading');
                //Event.fire.delay(.01,document,'load:objects_loading');
                
                objectLoadingTimer = Event.fire.delay(.01,document,'load:objects_loading');
                alert(objectLoadingTimer); => 6448


Here is the failure

Line: 5734
Error: Object doesn't support property or method 'dispatchEvent'
Reply all
Reply to author
Forward
0 new messages