[Proto-Scripty] Re: prototype 1.7, scriptalulous 1.9.0, FF 4.0 beta 9

2011-01-19 Thread Eric
Hi, I did have the second issue you have (regarding dragging from divs with scrollbars) a couple of months ago, but didn't get any helpful reply from the list (too specific issue perhaps). I am sorry but the only way I could fix it was to undust my pre- prototype drag'n drop code. However, the

[Proto-Scripty] document.fire() not defined

2011-01-19 Thread Krzysztof Głowinkowski
Hello everyone, I am currently testing a site using Prototype.js (version 1.7) on Internet Explorer 9 beta. Calling document.fire(dom:loaded) -produces following error : SCRIPT438: Object doesn't support this property or method. What can be wrong with document.fire? This error does not occur when

[Proto-Scripty] local variables for for() array iteration

2011-01-19 Thread Ran Berenfeld
Hello all sorry for this stupid question, but all these talks about the *this pointer and the variable scope in js got me confused. support I have 2 functions, one calling the other inside array iteration. can they both use the same local variable for array index ? should I use a var statement ?

Re: [Proto-Scripty] document.fire() not defined

2011-01-19 Thread Rüdiger Kaatz
Hi there, is this the first call to the prototype library? Maybe it does not load correctly? -- 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

Re: [Proto-Scripty] local variables for for() array iteration

2011-01-19 Thread Rüdiger Kaatz
Hi there, there are not stupid questions of course. They could be a bit more prototype-related though... All you should have to do is use var in order to make a variable local to the function it is declared in. In your example that would be: for(var i=0;iarray_b_length;i++) On Wed, Jan 19, 2011

[Proto-Scripty] Re: local variables for for() array iteration

2011-01-19 Thread T.J. Crowder
Hi, Yes, you should use a `var` statement -- specifically, two of them. With your functions as quoted, you're falling prey to the Horror of Implicit Globals[1], meaning that both your `A` and `B` functions are using the *same* variable (a global variable), and so of course `B` is interfering with

Re: [Proto-Scripty] local variables for for() array iteration

2011-01-19 Thread Ngoc Anh Doan
Do you try to access the same variable in both functions? If yes you could pass the function A array length to function B or bind it to function B. Cheers, Ngoc -- Blog: http://blog.nhdoan.de Magento: http://demo.mage.nhdoan.de Am 19.01.2011 um 14:31 schrieb Ran Berenfeld: Hello all

Re: [Proto-Scripty] local variables for for() array iteration

2011-01-19 Thread Rüdiger Kaatz
And last but not least, if this is a prototype mailing list you should of course use prototype, so your loops would look like this: $A(array_b_length).each(function(arrayElement) { // do something with the element... }); -- You received this message because you are subscribed to the Google

[Proto-Scripty] Re: local variables for for() array iteration

2011-01-19 Thread T.J. Crowder
@Rüdiger: And last but not least, if this is a prototype mailing list you should of course use prototype, so your loops would look like this: Whether I'm using Prototype or not, I don't need to create a function and incur the overhead of a function call on every iteration (not to mention the

Re: [Proto-Scripty] Re: local variables for for() array iteration

2011-01-19 Thread Rüdiger Kaatz
Hmm, it' is the prototype way of doing it. I suppose it has to do with writing beautiful code, but that might be a matter of taste. Some like it and some don't :-) On Wed, Jan 19, 2011 at 11:59 PM, T.J. Crowder t...@crowdersoftware.com wrote: @Rüdiger: And last but not least, if this is a

[Proto-Scripty] Re: local variables for for() array iteration

2011-01-19 Thread RobG
On Jan 19, 11:31 pm, Ran Berenfeld berenfeld...@gmail.com wrote: Hello all sorry for this stupid question, but all these talks about the *this pointer and the variable scope in js got me confused. A function's this keyword has nothing to do with scope. support I have 2 functions, one

Re: [Proto-Scripty] Re: local variables for for() array iteration

2011-01-19 Thread Ran Berenfeld
Thank you for the advise. one more / last question to clarify. In one of the articles about javascript scopes I read that using var inside a class constructor actually creates a private member of the class. is it true ? if this is true, then should I avoid using for (var i=0;iarr.length;i++) like