webmaster-mCnxYFlUP6xWk0Htik3J/w@public.gmane.org
2007-Nov-14 16:13 UTC
Magic on dom:loaded event in IE7
It''s really magic, I have this code:
...
initialize: function() {
...
document.observe("dom:loaded", function(event) {
this.updateClient(this.initialValues);
}.bind(this));
}
Well, within the constructor I''ve put the document.observe binded to
the same instance.
So, when I execute it in IE7, sometime it works, sometime not. I have
simplified the problem to this code:
document.observe("dom:loaded", function(event) {
alert(''hello, neng'');
}
same.
What''s wrong?
Thanks
Antonio
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
webmaster-mCnxYFlUP6xWk0Htik3J/w@public.gmane.org
2007-Nov-14 18:15 UTC
Re: Magic on dom:loaded event in IE7
Maybe is related to the event cache problem on IE? I''m ussing the prototype 1.6 RC1 Please, suggestions are welcome On Nov 14, 8:13 am, "webmas...-mCnxYFlUP6xWk0Htik3J/w@public.gmane.org" <webmas...-mCnxYFlUP6xWk0Htik3J/w@public.gmane.org> wrote:> It''s really magic, I have this code: > ... > initialize: function() { > ... > document.observe("dom:loaded", function(event) { > this.updateClient(this.initialValues); > }.bind(this)); > } > > Well, within the constructor I''ve put the document.observe binded to > the same instance. > So, when I execute it in IE7, sometime it works, sometime not. I have > simplified the problem to this code: > > document.observe("dom:loaded", function(event) { > alert(''hello, neng''); > } > > same. > > What''s wrong? > > Thanks > Antonio--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
webmaster-mCnxYFlUP6xWk0Htik3J/w@public.gmane.org
2007-Nov-14 18:25 UTC
Re: Magic on dom:loaded event in IE7
I think that my problem is related to this problem (found in another forum) : The dom:loaded event under IE7 appears to fire much earlier than it does under FF - this means that some of my observers dont get attached before the event fires under IE7 - and therefore the functions being attached dont get run under IE7 (everything works fine in FF). Is there any way to tell if dom:loaded has already fired when setting up the observers? or to make functions attached to dom:loaded get automatically run if dom:loaded has already fired? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
>or to make functions attached to dom:loaded get >automatically run if dom:loaded has already fired?I asked this but a few hours ago! On Nov 15, 2007 7:25 AM, webmaster-mCnxYFlUP6xWk0Htik3J/w@public.gmane.org <webmaster-mCnxYFlUP6xWk0Htik3J/w@public.gmane.org> wrote:> > I think that my problem is related to this problem (found in another > forum) : > > The dom:loaded event under IE7 appears to fire much earlier than it > does under FF - this means that some of my observers dont get attached > before the event fires under IE7 - and therefore the functions being > attached dont get run under IE7 (everything works fine in FF). Is > there any way to tell if dom:loaded has already fired when setting up > the observers? or to make functions attached to dom:loaded get > automatically run if dom:loaded has already fired? > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
webmaster-mCnxYFlUP6xWk0Htik3J/w@public.gmane.org
2007-Nov-14 21:38 UTC
Re: Magic on dom:loaded event in IE7
What I have done finally is to use this code:
//if the dom has loaded, execute the initClient:
if ((Prototype.Browser.WebKit && /loaded|
complete/.test(document.readyState)) ||
($("__onDOMContentLoaded") && $
("__onDOMContentLoaded").readyState == "complete")) {
this.initClient();
}
//otherwise, observe the dom:loaded event to execute the
initClient
else {
document.observe("dom:loaded", function(event) {
this.initClient();
}.bind(this));
}
Maybe there is another way more elegant to know if the dom has loaded.
If anybody knows, please let us know.
Regards
Antonio
On Nov 14, 12:37 pm, "Gareth Evans"
<agr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> >or to make functions attached to dom:loaded get
> >automatically run if dom:loaded has already fired?
>
> I asked this but a few hours ago!
>
> On Nov 15, 2007 7:25 AM, webmas...-mCnxYFlUP6xWk0Htik3J/w@public.gmane.org
<webmas...-mCnxYFlUP6xWk0Htik3J/w@public.gmane.org>
> wrote:
>
>
>
>
>
> > I think that my problem is related to this problem (found in another
> > forum) :
>
> > The dom:loaded event under IE7 appears to fire much earlier than it
> > does under FF - this means that some of my observers dont get attached
> > before the event fires under IE7 - and therefore the functions being
> > attached dont get run under IE7 (everything works fine in FF). Is
> > there any way to tell if dom:loaded has already fired when setting up
> > the observers? or to make functions attached to dom:loaded get
> > automatically run if dom:loaded has already fired?- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---