How does dom:ready prevent multiple executions of the same script? On Dec 16, 6:16 am, "Alex McAuley" <[email protected]> wrote: > Why not attach the widget code to dom:ready.... > > Alex Mcauleyhttp://www.thevacancymarket.com > > ----- Original Message ----- > From: "JoJo" <[email protected]> > To: "Prototype & script.aculo.us" <[email protected]> > Sent: Tuesday, December 15, 2009 8:57 PM > Subject: [Proto-Scripty] Firefox's inline JS execution order > > > I'm creating a widget where I tell people to copy and paste this code > > onto their site: > > > <script type="text/javscript" src="http://www.site.com/script.js"></ > > script> > > <div class="widget"></div> > > > Script.js looks for all the widget divs on the page by using $$ and > > dynamically fills them up. Now, I'm not catering to nerd programmers > > who know that it's better to do this when they need to embed multiple > > widgets: > > > <head> > > <script> > > </head> > > <body> > > <div class="widget"></div> > > <div class="widget"></div> > > <div class="widget"></div> > > </body> > > > Instead, I'm expecting stupid people to be doing this: > > > <body> > > <script> > > <div class="widget"></div> > > <script> > > <div class="widget"></div> > > <script> > > <div class="widget"></div> > > </body> > > > So I've tried to only execute my script once using: > > > if (typeof(RAN_ONCE) === 'undefined') { > > RAN_ONCE = true; > > // minified Prototype code here > > // minified my widget code here > > } > > > This code works well in IE, but not in FF. FF always reports an error > > saying $A is undefined. I'm guessing that FF actually ran my code in > > parellel and thus Prototype got redefined and screwed up? Does anyone > > know how execution order is different in IE and FF with inline JS? > > > -- > > > You received this message because you are subscribed to the Google Groups > > "Prototype & script.aculo.us" group. > > To post to this group, send email to > > [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group at > >http://groups.google.com/group/prototype-scriptaculous?hl=en.
-- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
