[Proto-Scripty] Re: execution order in IE

2009-09-06 Thread T.J. Crowder

*IN*teresting.  Thanks for posting back, JoJo.

-- T.J.

On Sep 6, 6:14 am, JoJo tokyot...@gmail.com wrote:
 I wanted everyone to know that I was stupid to be testing this in
 IE8's IE7 backwards compatability mode.  This error never occurs in
 the real IE7. It's just a warning for everyone, never use IE8's
 backwards mode when web designing.

 On Sep 4, 2:22 pm, T.J. Crowder t...@crowdersoftware.com wrote:



  Hi JoJo,

  Excellent example of a pared-down test case, thanks for that.

  I don't have time right now to try this, but just quickly:  You say
  that the code in the load event never runs, are you sure you haven't
  interrupted it by clicking the button really early and causing the
  error?  The window.load event happens quite late in the overall load
  process; you might consider using

  document.observe(dom:loaded, function() {
     // ...

  });

  instead, it happens earlier and might reduce the window of time in
  which a user can cause the problem...

  (This is speculation at present.)
  --
  T.J. Crowder
  tj / crowder software / comwww.crowdersoftware.com

  On Sep 4, 9:22 pm, JoJo tokyot...@gmail.com wrote:

   So I did quite a lot of tests with the above script.  Whenever the
   error occurs, the Event.observe was never run.  You can stick other
   code in that event, and it will not run.  Now that I'm testing on
   another computer, it seems to only fail 10% of the time on IE8 in IE7
   mode.

   On Sep 4, 10:01 am, JoJo tokyot...@gmail.com wrote:

Hi TJ,

This is the simple script which will say MYAPP.class1 is null or not
an object - Line 33 about 25% of the time on IE8 in IE7-compatability-
mode.  You must hit refresh a few times and then click the button to
see the error.  Maybe we need to find out what makes IE7 and 6's JS
engine different from IE8's.



!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
html
    head
        script src=scripts/lib/prototype.js type=text/
javascript/script
        script src=scripts/src/scriptaculous.js type=text/
javascript/script
        script type=text/javascript
            //![CDATA[
            var MYAPP = {
                Class1: null,
                class1: null
            }

            MYAPP.Class1 = Class.create({
                initialize: function() {
                    this.myValue = 'my value';
                },
                speak: function() {
                    alert(this.myValue);
                }
            });

            Event.observe(window, 'load', function() {
                MYAPP.class1 = new MYAPP.Class1();
            });
            //]]
        /script
    /head
    body
        button onclick=MYAPP.class1.speak() /make class1 speak/
button
    /body
/html

+

On Sep 4, 12:51 am, T.J. Crowder t...@crowdersoftware.com wrote:

 Hi JoJo,

 I suspect there's some small (but important) piece of information or
 understanding that you don't have, being a beginner, but we're
 shooting a bit in the dark trying to identify it.

 Can you create an example of the problem using one very simple HTML
 file and (say) two script files?  (Three if you need it to make the
 problem occur.)  Paste them in Pastie[1] and drop us a link here, and
 we'll try to figure it out.

 FWIW, I've never had a problem with files getting loaded and executed
 out of order.  I find it very, very hard to believe that that's
 actually happening (Alex, if you have a reference for your earlier
 comment, please do share it), the number of sites that would break is
 legion.

 If that really _is_ happening, another way to solve it is to combine
 all of your JavaScript files into one file as part of a build
 process.  There are good reasons for doing that anyway; more here.[2]

 [1]http://pastie.org
 [2]http://proto-scripty.wikidot.com/prototype:tip-minimizing-download-times

 HTH,
 --
 T.J. Crowder
 tj / crowder software / comwww.crowdersoftware.com

 On Sep 4, 7:17 am, JoJo tokyot...@gmail.com wrote:

  My classes are just class definitions.

  MYAPP.Class1= Class.create({...});
  MYAPP.Class2= Class.create({...});

  I don't create the objects until I get to main.js, which creates 
  them
  after the window has loaded.  Why is IE7 not giving an error when I
  access MYAPP in Class1.js and Class2.js, but is giving an error 
  when I
  access it in main.js? This native and function object talk just went
  straight over my head.  I am only a beginner to JS.

  On Sep 3, 10:51 pm, RobG robg...@gmail.com wrote:

   On Sep 4, 3:43 pm, RobG robg...@gmail.com wrote:

On Sep 4, 4:40 am, 

[Proto-Scripty] Re: execution order in IE

2009-09-05 Thread JoJo

I wanted everyone to know that I was stupid to be testing this in
IE8's IE7 backwards compatability mode.  This error never occurs in
the real IE7. It's just a warning for everyone, never use IE8's
backwards mode when web designing.

On Sep 4, 2:22 pm, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi JoJo,

 Excellent example of a pared-down test case, thanks for that.

 I don't have time right now to try this, but just quickly:  You say
 that the code in the load event never runs, are you sure you haven't
 interrupted it by clicking the button really early and causing the
 error?  The window.load event happens quite late in the overall load
 process; you might consider using

 document.observe(dom:loaded, function() {
    // ...

 });

 instead, it happens earlier and might reduce the window of time in
 which a user can cause the problem...

 (This is speculation at present.)
 --
 T.J. Crowder
 tj / crowder software / comwww.crowdersoftware.com

 On Sep 4, 9:22 pm, JoJo tokyot...@gmail.com wrote:

  So I did quite a lot of tests with the above script.  Whenever the
  error occurs, the Event.observe was never run.  You can stick other
  code in that event, and it will not run.  Now that I'm testing on
  another computer, it seems to only fail 10% of the time on IE8 in IE7
  mode.

  On Sep 4, 10:01 am, JoJo tokyot...@gmail.com wrote:

   Hi TJ,

   This is the simple script which will say MYAPP.class1 is null or not
   an object - Line 33 about 25% of the time on IE8 in IE7-compatability-
   mode.  You must hit refresh a few times and then click the button to
   see the error.  Maybe we need to find out what makes IE7 and 6's JS
   engine different from IE8's.

   

   !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN 
   http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
   html
       head
           script src=scripts/lib/prototype.js type=text/
   javascript/script
           script src=scripts/src/scriptaculous.js type=text/
   javascript/script
           script type=text/javascript
               //![CDATA[
               var MYAPP = {
                   Class1: null,
                   class1: null
               }

               MYAPP.Class1 = Class.create({
                   initialize: function() {
                       this.myValue = 'my value';
                   },
                   speak: function() {
                       alert(this.myValue);
                   }
               });

               Event.observe(window, 'load', function() {
                   MYAPP.class1 = new MYAPP.Class1();
               });
               //]]
           /script
       /head
       body
           button onclick=MYAPP.class1.speak() /make class1 speak/
   button
       /body
   /html

   +

   On Sep 4, 12:51 am, T.J. Crowder t...@crowdersoftware.com wrote:

Hi JoJo,

I suspect there's some small (but important) piece of information or
understanding that you don't have, being a beginner, but we're
shooting a bit in the dark trying to identify it.

Can you create an example of the problem using one very simple HTML
file and (say) two script files?  (Three if you need it to make the
problem occur.)  Paste them in Pastie[1] and drop us a link here, and
we'll try to figure it out.

FWIW, I've never had a problem with files getting loaded and executed
out of order.  I find it very, very hard to believe that that's
actually happening (Alex, if you have a reference for your earlier
comment, please do share it), the number of sites that would break is
legion.

If that really _is_ happening, another way to solve it is to combine
all of your JavaScript files into one file as part of a build
process.  There are good reasons for doing that anyway; more here.[2]

[1]http://pastie.org
[2]http://proto-scripty.wikidot.com/prototype:tip-minimizing-download-times

HTH,
--
T.J. Crowder
tj / crowder software / comwww.crowdersoftware.com

On Sep 4, 7:17 am, JoJo tokyot...@gmail.com wrote:

 My classes are just class definitions.

 MYAPP.Class1= Class.create({...});
 MYAPP.Class2= Class.create({...});

 I don't create the objects until I get to main.js, which creates them
 after the window has loaded.  Why is IE7 not giving an error when I
 access MYAPP in Class1.js and Class2.js, but is giving an error when I
 access it in main.js? This native and function object talk just went
 straight over my head.  I am only a beginner to JS.

 On Sep 3, 10:51 pm, RobG robg...@gmail.com wrote:

  On Sep 4, 3:43 pm, RobG robg...@gmail.com wrote:

   On Sep 4, 4:40 am, JoJo tokyot...@gmail.com wrote:

^ great article!

Now I have another question.  Here is my new workflow in an 
attempt to
execute files in the correct order across all browsers.  It 
works 

[Proto-Scripty] Re: execution order in IE

2009-09-04 Thread JoJo

Hi TJ,

This is the simple script which will say MYAPP.class1 is null or not
an object - Line 33 about 25% of the time on IE8 in IE7-compatability-
mode.  You must hit refresh a few times and then click the button to
see the error.  Maybe we need to find out what makes IE7 and 6's JS
engine different from IE8's.



!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://
www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
html
head
script src=scripts/lib/prototype.js type=text/
javascript/script
script src=scripts/src/scriptaculous.js type=text/
javascript/script
script type=text/javascript
//![CDATA[
var MYAPP = {
Class1: null,
class1: null
}

MYAPP.Class1 = Class.create({
initialize: function() {
this.myValue = 'my value';
},
speak: function() {
alert(this.myValue);
}
});

Event.observe(window, 'load', function() {
MYAPP.class1 = new MYAPP.Class1();
});
//]]
/script
/head
body
button onclick=MYAPP.class1.speak() /make class1 speak/
button
/body
/html

+

On Sep 4, 12:51 am, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi JoJo,

 I suspect there's some small (but important) piece of information or
 understanding that you don't have, being a beginner, but we're
 shooting a bit in the dark trying to identify it.

 Can you create an example of the problem using one very simple HTML
 file and (say) two script files?  (Three if you need it to make the
 problem occur.)  Paste them in Pastie[1] and drop us a link here, and
 we'll try to figure it out.

 FWIW, I've never had a problem with files getting loaded and executed
 out of order.  I find it very, very hard to believe that that's
 actually happening (Alex, if you have a reference for your earlier
 comment, please do share it), the number of sites that would break is
 legion.

 If that really _is_ happening, another way to solve it is to combine
 all of your JavaScript files into one file as part of a build
 process.  There are good reasons for doing that anyway; more here.[2]

 [1]http://pastie.org
 [2]http://proto-scripty.wikidot.com/prototype:tip-minimizing-download-times

 HTH,
 --
 T.J. Crowder
 tj / crowder software / comwww.crowdersoftware.com

 On Sep 4, 7:17 am, JoJo tokyot...@gmail.com wrote:

  My classes are just class definitions.

  MYAPP.Class1= Class.create({...});
  MYAPP.Class2= Class.create({...});

  I don't create the objects until I get to main.js, which creates them
  after the window has loaded.  Why is IE7 not giving an error when I
  access MYAPP in Class1.js and Class2.js, but is giving an error when I
  access it in main.js? This native and function object talk just went
  straight over my head.  I am only a beginner to JS.

  On Sep 3, 10:51 pm, RobG robg...@gmail.com wrote:

   On Sep 4, 3:43 pm, RobG robg...@gmail.com wrote:

On Sep 4, 4:40 am, JoJo tokyot...@gmail.com wrote:

 ^ great article!

 Now I have another question.  Here is my new workflow in an attempt to
 execute files in the correct order across all browsers.  It works in
 IE8, but not in IE7.  In IE7 I get an error saying object expected
 on line 2 of main.js.  This is not very descriptive; what does it
 mean?

 (1) include my global wrapper MYAPP.js:

     MYAPP = {class1: null, class2: null}

MYAPP is an instance of the built-in Object object (i.e. a native
object). Because it has not been declared, it doesn't exist until the
code is executed.

   That is, until that line of code is executed.

 (2) include Class1.js (no instantiation)
 (3) include Class2.js (no instantiation)
 (4) include main.js:

     Event.observe(window, 'load', function() {
         MYAPP.class1  = new MYAPP.Class1();

Even if MYAPP exists at this point, the above won't work: the only
native objects that can be used as constructors are function objects.
MYAPP is and native object, it can't be used as a constructor as it
doesn't have an internal [[consruct]] method (functions do).

   Ooops, you're actually calling MYAPP.Class1 as a constructor, hey
   nasty. You say the other script files don't to any instantiation, so
   how do the MYAPP.Class1 and 2 properties get set?

   --
   Rob
--~--~-~--~~~---~--~~
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 prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 

[Proto-Scripty] Re: execution order in IE

2009-09-04 Thread JoJo

So I did quite a lot of tests with the above script.  Whenever the
error occurs, the Event.observe was never run.  You can stick other
code in that event, and it will not run.  Now that I'm testing on
another computer, it seems to only fail 10% of the time on IE8 in IE7
mode.

On Sep 4, 10:01 am, JoJo tokyot...@gmail.com wrote:
 Hi TJ,

 This is the simple script which will say MYAPP.class1 is null or not
 an object - Line 33 about 25% of the time on IE8 in IE7-compatability-
 mode.  You must hit refresh a few times and then click the button to
 see the error.  Maybe we need to find out what makes IE7 and 6's JS
 engine different from IE8's.

 

 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN 
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
 html
     head
         script src=scripts/lib/prototype.js type=text/
 javascript/script
         script src=scripts/src/scriptaculous.js type=text/
 javascript/script
         script type=text/javascript
             //![CDATA[
             var MYAPP = {
                 Class1: null,
                 class1: null
             }

             MYAPP.Class1 = Class.create({
                 initialize: function() {
                     this.myValue = 'my value';
                 },
                 speak: function() {
                     alert(this.myValue);
                 }
             });

             Event.observe(window, 'load', function() {
                 MYAPP.class1 = new MYAPP.Class1();
             });
             //]]
         /script
     /head
     body
         button onclick=MYAPP.class1.speak() /make class1 speak/
 button
     /body
 /html

 +

 On Sep 4, 12:51 am, T.J. Crowder t...@crowdersoftware.com wrote:

  Hi JoJo,

  I suspect there's some small (but important) piece of information or
  understanding that you don't have, being a beginner, but we're
  shooting a bit in the dark trying to identify it.

  Can you create an example of the problem using one very simple HTML
  file and (say) two script files?  (Three if you need it to make the
  problem occur.)  Paste them in Pastie[1] and drop us a link here, and
  we'll try to figure it out.

  FWIW, I've never had a problem with files getting loaded and executed
  out of order.  I find it very, very hard to believe that that's
  actually happening (Alex, if you have a reference for your earlier
  comment, please do share it), the number of sites that would break is
  legion.

  If that really _is_ happening, another way to solve it is to combine
  all of your JavaScript files into one file as part of a build
  process.  There are good reasons for doing that anyway; more here.[2]

  [1]http://pastie.org
  [2]http://proto-scripty.wikidot.com/prototype:tip-minimizing-download-times

  HTH,
  --
  T.J. Crowder
  tj / crowder software / comwww.crowdersoftware.com

  On Sep 4, 7:17 am, JoJo tokyot...@gmail.com wrote:

   My classes are just class definitions.

   MYAPP.Class1= Class.create({...});
   MYAPP.Class2= Class.create({...});

   I don't create the objects until I get to main.js, which creates them
   after the window has loaded.  Why is IE7 not giving an error when I
   access MYAPP in Class1.js and Class2.js, but is giving an error when I
   access it in main.js? This native and function object talk just went
   straight over my head.  I am only a beginner to JS.

   On Sep 3, 10:51 pm, RobG robg...@gmail.com wrote:

On Sep 4, 3:43 pm, RobG robg...@gmail.com wrote:

 On Sep 4, 4:40 am, JoJo tokyot...@gmail.com wrote:

  ^ great article!

  Now I have another question.  Here is my new workflow in an attempt 
  to
  execute files in the correct order across all browsers.  It works in
  IE8, but not in IE7.  In IE7 I get an error saying object expected
  on line 2 of main.js.  This is not very descriptive; what does it
  mean?

  (1) include my global wrapper MYAPP.js:

      MYAPP = {class1: null, class2: null}

 MYAPP is an instance of the built-in Object object (i.e. a native
 object). Because it has not been declared, it doesn't exist until the
 code is executed.

That is, until that line of code is executed.

  (2) include Class1.js (no instantiation)
  (3) include Class2.js (no instantiation)
  (4) include main.js:

      Event.observe(window, 'load', function() {
          MYAPP.class1  = new MYAPP.Class1();

 Even if MYAPP exists at this point, the above won't work: the only
 native objects that can be used as constructors are function objects.
 MYAPP is and native object, it can't be used as a constructor as it
 doesn't have an internal [[consruct]] method (functions do).

Ooops, you're actually calling MYAPP.Class1 as a constructor, hey
nasty. You say the other script files don't to any instantiation, so
how do the MYAPP.Class1 and 2 properties get set?

--
   

[Proto-Scripty] Re: execution order in IE

2009-09-03 Thread Alex McAuley

If you need to garuntee that a variable,function or method exists i would 
always wait until the dom is ready or in each function that gets called test 
the function,variable or method exists else timeout untill it does
Alex Mcauley
http://www.thevacancymarket.com
- Original Message - 
From: JoJo tokyot...@gmail.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Thursday, September 03, 2009 6:31 AM
Subject: [Proto-Scripty] execution order in IE



 In my head, I'm loading several JS files.  I'm expecting this to
 occur:

 1) script1.js is loaded
 2) script1.js runs - it creates an object
 3) script2.js is loaded
 4) script2.js runs - it creates a different object that depends on
 script1's object.
 5) and so on

 This works perfectly in Firefox and Safari, but fails about 25% of the
 time in IE.  I've heard that IE will load JS files in the correct
 order, but will not guarantee that they are executed in the same
 order.  How can I restructure my code or use Prototype to fix my
 current code?
 
 


--~--~-~--~~~---~--~~
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 prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: execution order in IE

2009-09-03 Thread DJ Mangus
See this article:
http://proto-scripty.wikidot.com/prototype:how-to-load-scripts-dynamically

On Thu, Sep 3, 2009 at 9:25 AM, JoJo tokyot...@gmail.com wrote:


 Instead of loading JS in the head, how do I do includes like
 virtually all other languages?  Isn't Scriptaculous loading Effects.js
 and other files?  How is it doing that?

 On Sep 2, 11:36 pm, Alex McAuley webmas...@thecarmarketplace.com
 wrote:
  If you need to garuntee that a variable,function or method exists i would
  always wait until the dom is ready or in each function that gets called
 test
  the function,variable or method exists else timeout untill it does
  Alex Mcauleyhttp://www.thevacancymarket.com
 
  - Original Message -
  From: JoJo tokyot...@gmail.com
  To: Prototype  script.aculo.us 
 prototype-scriptaculous@googlegroups.com
  Sent: Thursday, September 03, 2009 6:31 AM
  Subject: [Proto-Scripty] execution order in IE
 
   In my head, I'm loading several JS files.  I'm expecting this to
   occur:
 
   1) script1.js is loaded
   2) script1.js runs - it creates an object
   3) script2.js is loaded
   4) script2.js runs - it creates a different object that depends on
   script1's object.
   5) and so on
 
   This works perfectly in Firefox and Safari, but fails about 25% of the
   time in IE.  I've heard that IE will load JS files in the correct
   order, but will not guarantee that they are executed in the same
   order.  How can I restructure my code or use Prototype to fix my
   current code?
 


--~--~-~--~~~---~--~~
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 prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: execution order in IE

2009-09-03 Thread JoJo

^ great article!

Now I have another question.  Here is my new workflow in an attempt to
execute files in the correct order across all browsers.  It works in
IE8, but not in IE7.  In IE7 I get an error saying object expected
on line 2 of main.js.  This is not very descriptive; what does it
mean?

(1) include my global wrapper MYAPP.js:

MYAPP = {class1: null, class2: null}

(2) include Class1.js (no instantiation)
(3) include Class2.js (no instantiation)
(4) include main.js:

Event.observe(window, 'load', function() {
MYAPP.class1  = new MYAPP.Class1();
MYAPP.class2  = new MYAPP.Class2();
});

On Sep 3, 10:40 am, DJ Mangus d.man...@gmail.com wrote:
 See this 
 article:http://proto-scripty.wikidot.com/prototype:how-to-load-scripts-dynami...

 On Thu, Sep 3, 2009 at 9:25 AM, JoJo tokyot...@gmail.com wrote:

  Instead of loading JS in the head, how do I do includes like
  virtually all other languages?  Isn't Scriptaculous loading Effects.js
  and other files?  How is it doing that?

  On Sep 2, 11:36 pm, Alex McAuley webmas...@thecarmarketplace.com
  wrote:
   If you need to garuntee that a variable,function or method exists i would
   always wait until the dom is ready or in each function that gets called
  test
   the function,variable or method exists else timeout untill it does
   Alex Mcauleyhttp://www.thevacancymarket.com

   - Original Message -
   From: JoJo tokyot...@gmail.com
   To: Prototype  script.aculo.us 
  prototype-scriptaculous@googlegroups.com
   Sent: Thursday, September 03, 2009 6:31 AM
   Subject: [Proto-Scripty] execution order in IE

In my head, I'm loading several JS files.  I'm expecting this to
occur:

1) script1.js is loaded
2) script1.js runs - it creates an object
3) script2.js is loaded
4) script2.js runs - it creates a different object that depends on
script1's object.
5) and so on

This works perfectly in Firefox and Safari, but fails about 25% of the
time in IE.  I've heard that IE will load JS files in the correct
order, but will not guarantee that they are executed in the same
order.  How can I restructure my code or use Prototype to fix my
current code?
--~--~-~--~~~---~--~~
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 prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: execution order in IE

2009-09-03 Thread Alex McAuley

Sometimes IE moans about the lack of a semi colon on the end of some Json'd 
code

For example

var foo ={bar:function(){alert('Hi');}}

fails in some IE's (cant remember which one) but

var foo ={bar:function(){alert('Hi');};

Works in every browser - i had to update some code to fix similar errors on 
my web desktop

Alex Mcauley
http://www.thevacancymarket.com
- Original Message - 
From: JoJo tokyot...@gmail.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Thursday, September 03, 2009 7:40 PM
Subject: [Proto-Scripty] Re: execution order in IE



^ great article!

Now I have another question.  Here is my new workflow in an attempt to
execute files in the correct order across all browsers.  It works in
IE8, but not in IE7.  In IE7 I get an error saying object expected
on line 2 of main.js.  This is not very descriptive; what does it
mean?

(1) include my global wrapper MYAPP.js:

MYAPP = {class1: null, class2: null}

(2) include Class1.js (no instantiation)
(3) include Class2.js (no instantiation)
(4) include main.js:

Event.observe(window, 'load', function() {
MYAPP.class1  = new MYAPP.Class1();
MYAPP.class2  = new MYAPP.Class2();
});

On Sep 3, 10:40 am, DJ Mangus d.man...@gmail.com wrote:
 See this 
 article:http://proto-scripty.wikidot.com/prototype:how-to-load-scripts-dynami...

 On Thu, Sep 3, 2009 at 9:25 AM, JoJo tokyot...@gmail.com wrote:

  Instead of loading JS in the head, how do I do includes like
  virtually all other languages? Isn't Scriptaculous loading Effects.js
  and other files? How is it doing that?

  On Sep 2, 11:36 pm, Alex McAuley webmas...@thecarmarketplace.com
  wrote:
   If you need to garuntee that a variable,function or method exists i 
   would
   always wait until the dom is ready or in each function that gets 
   called
  test
   the function,variable or method exists else timeout untill it does
   Alex Mcauleyhttp://www.thevacancymarket.com

   - Original Message -
   From: JoJo tokyot...@gmail.com
   To: Prototype  script.aculo.us 
  prototype-scriptaculous@googlegroups.com
   Sent: Thursday, September 03, 2009 6:31 AM
   Subject: [Proto-Scripty] execution order in IE

In my head, I'm loading several JS files. I'm expecting this to
occur:

1) script1.js is loaded
2) script1.js runs - it creates an object
3) script2.js is loaded
4) script2.js runs - it creates a different object that depends on
script1's object.
5) and so on

This works perfectly in Firefox and Safari, but fails about 25% of 
the
time in IE. I've heard that IE will load JS files in the correct
order, but will not guarantee that they are executed in the same
order. How can I restructure my code or use Prototype to fix my
current code?



--~--~-~--~~~---~--~~
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 prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: execution order in IE

2009-09-03 Thread JoJo

I added a semicolon to the end of my global wrapper var:

var MYAPP = {class1: null, class2: null};

But I still get the same order. I believe that since this is
executable code, IE doesn't care if it creates it AFTER I try to use
it.

On Sep 3, 12:56 pm, Alex McAuley webmas...@thecarmarketplace.com
wrote:
 Sometimes IE moans about the lack of a semi colon on the end of some Json'd
 code

 For example

 var foo ={bar:function(){alert('Hi');}}

 fails in some IE's (cant remember which one) but

 var foo ={bar:function(){alert('Hi');};

 Works in every browser - i had to update some code to fix similar errors on
 my web desktop

 Alex Mcauleyhttp://www.thevacancymarket.com

 - Original Message -
 From: JoJo tokyot...@gmail.com
 To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
 Sent: Thursday, September 03, 2009 7:40 PM
 Subject: [Proto-Scripty] Re: execution order in IE

 ^ great article!

 Now I have another question.  Here is my new workflow in an attempt to
 execute files in the correct order across all browsers.  It works in
 IE8, but not in IE7.  In IE7 I get an error saying object expected
 on line 2 of main.js.  This is not very descriptive; what does it
 mean?

 (1) include my global wrapper MYAPP.js:

     MYAPP = {class1: null, class2: null}

 (2) include Class1.js (no instantiation)
 (3) include Class2.js (no instantiation)
 (4) include main.js:

     Event.observe(window, 'load', function() {
         MYAPP.class1  = new MYAPP.Class1();
         MYAPP.class2  = new MYAPP.Class2();
     });

 On Sep 3, 10:40 am, DJ Mangus d.man...@gmail.com wrote:
  See this
  article:http://proto-scripty.wikidot.com/prototype:how-to-load-scripts-dynami...

  On Thu, Sep 3, 2009 at 9:25 AM, JoJo tokyot...@gmail.com wrote:

   Instead of loading JS in the head, how do I do includes like
   virtually all other languages? Isn't Scriptaculous loading Effects.js
   and other files? How is it doing that?

   On Sep 2, 11:36 pm, Alex McAuley webmas...@thecarmarketplace.com
   wrote:
If you need to garuntee that a variable,function or method exists i
would
always wait until the dom is ready or in each function that gets
called
   test
the function,variable or method exists else timeout untill it does
Alex Mcauleyhttp://www.thevacancymarket.com

- Original Message -
From: JoJo tokyot...@gmail.com
To: Prototype  script.aculo.us 
   prototype-scriptaculous@googlegroups.com
Sent: Thursday, September 03, 2009 6:31 AM
Subject: [Proto-Scripty] execution order in IE

 In my head, I'm loading several JS files. I'm expecting this to
 occur:

 1) script1.js is loaded
 2) script1.js runs - it creates an object
 3) script2.js is loaded
 4) script2.js runs - it creates a different object that depends on
 script1's object.
 5) and so on

 This works perfectly in Firefox and Safari, but fails about 25% of
 the
 time in IE. I've heard that IE will load JS files in the correct
 order, but will not guarantee that they are executed in the same
 order. How can I restructure my code or use Prototype to fix my
 current code?
--~--~-~--~~~---~--~~
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 prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---