[Proto-Scripty] Re: Possible prototype bug ?

2009-02-11 Thread Alex Mcauley

Thanks SWilk ... i saved myself the hassle and changed the classname it was 
looking for instead !!
- Original Message - 
From: "SWilk" 
To: 
Sent: Tuesday, February 10, 2009 5:24 PM
Subject: [Proto-Scripty] Re: Possible prototype bug ?


>
> Hey,
>
> I think you are missing the point of Element.next() and Element.down().
>
> Assuming you run the code you pasted into another message in this thread:
>
> $$('.cancel').each( function(element) {
> alert($(element).next()); // returns undefined ? 
> alert($(element).down()); // returns undefined ? 
> });
>
> This gets element with class .cancel, in the DOM below it is an
>  element, LAST element inside the .
>
> As it is the last element inside that div, then it has no siblings
> after it, so there is no next() element. If you try to run
> Element.prev() on this element, it should return the previous img,
> with class "save".
>
> Same with Element.down(); IMG elements can have NO children. There are
> no children elements of your img.cancel tag, then down() returns null.
> If you try to go up() the DOM, then you will reach the parent element
> of your img - .
>
> What I am trying to say is that you can go next() and prev() only on
> same DOM branch, you can not "jump" to another branch.
>
> To reach  from  you need
> to go up() from IMG, and then go next().
>
> Regards,
> SWilk
>
>
> Jeztah wrote:
>> 
>>   
>>   
>> 
>> 
>> 
>> 
>>
>> with the above DOM / Html setup i have invoked a click on
>> class="cancel" like so ..
>>
>>
>> how can this possibly be if the html is nowhere near the end of the
>> document ? .. its confusing the hell out of me, or am i missing the
>> point of what next() / down() are meant to do .. as i was under the
>> impression that they were to traverse up and down the DOM !!
>> >
>>
>
>
> >
> 


--~--~-~--~~~---~--~~
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: Possible prototype bug ?

2009-02-10 Thread SWilk

Hey,

I think you are missing the point of Element.next() and Element.down().

Assuming you run the code you pasted into another message in this thread:

$$('.cancel').each( function(element) {
alert($(element).next()); // returns undefined ? 
alert($(element).down()); // returns undefined ? 
});

This gets element with class .cancel, in the DOM below it is an 
 element, LAST element inside the .

As it is the last element inside that div, then it has no siblings 
after it, so there is no next() element. If you try to run 
Element.prev() on this element, it should return the previous img, 
with class "save".

Same with Element.down(); IMG elements can have NO children. There are 
no children elements of your img.cancel tag, then down() returns null.
If you try to go up() the DOM, then you will reach the parent element 
of your img - .

What I am trying to say is that you can go next() and prev() only on 
same DOM branch, you can not "jump" to another branch.

To reach  from  you need 
to go up() from IMG, and then go next().

Regards,
SWilk


Jeztah wrote:
> 
>   
>   
> 
> 
> 
> 
> 
> with the above DOM / Html setup i have invoked a click on
> class="cancel" like so ..
>
> 
> how can this possibly be if the html is nowhere near the end of the
> document ? .. its confusing the hell out of me, or am i missing the
> point of what next() / down() are meant to do .. as i was under the
> impression that they were to traverse up and down the DOM !!
> > 
> 


--~--~-~--~~~---~--~~
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: Possible prototype bug ?

2009-02-10 Thread Walter Lee Davis

each uses the element as the first argument, so if you had an  
enumerable collection of whatsits, and you called each on the  
collection, the first argument to your function would be the extended  
element. See <http://prototypejs.org/api/enumerable> for more details.

$$('div.foo').each(function(elm, idx){ alert(idx + ': ' + elm.id) });

Walter

On Feb 10, 2009, at 11:41 AM, Alex Mcauley wrote:

>
> i am not observing .. simply calling the alerts on each of
> $$('.classname')..
>
> Does that still take event as the first argument
>
> Thanks
> Alex
>
> - Original Message -
> From: "Walter Lee Davis" 
> To: 
> Sent: Tuesday, February 10, 2009 4:39 PM
> Subject: [Proto-Scripty] Re: Possible prototype bug ?
>
>
>>
>> Forget this part, it's wrong. The second example works. See
>> <http://prototypejs.org/api/element/observe
>>> for why.
>>
>> Walter
>>
>> On Feb 10, 2009, at 11:35 AM, Walter Lee Davis wrote:
>>
>>> observe's function takes the event as the first argument, the  
>>> element
>>> as the second. Change your function to
>>>
>>> function(evt,elm){
>>> alert(elm.next());
>>> }
>>
>>
>>>
>>
>
>
> >


--~--~-~--~~~---~--~~
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: Possible prototype bug ?

2009-02-10 Thread Alex Mcauley

i am not observing .. simply calling the alerts on each of 
$$('.classname')..

Does that still take event as the first argument

Thanks
Alex

- Original Message - 
From: "Walter Lee Davis" 
To: 
Sent: Tuesday, February 10, 2009 4:39 PM
Subject: [Proto-Scripty] Re: Possible prototype bug ?


>
> Forget this part, it's wrong. The second example works. See 
> <http://prototypejs.org/api/element/observe
> > for why.
>
> Walter
>
> On Feb 10, 2009, at 11:35 AM, Walter Lee Davis wrote:
>
>> observe's function takes the event as the first argument, the element
>> as the second. Change your function to
>>
>> function(evt,elm){
>> alert(elm.next());
>> }
>
>
> >
> 


--~--~-~--~~~---~--~~
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: Possible prototype bug ?

2009-02-10 Thread Walter Lee Davis

Forget this part, it's wrong. The second example works. See 
 for why.

Walter

On Feb 10, 2009, at 11:35 AM, Walter Lee Davis wrote:

> observe's function takes the event as the first argument, the element
> as the second. Change your function to
>
>   function(evt,elm){
>   alert(elm.next());
>   }


--~--~-~--~~~---~--~~
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: Possible prototype bug ?

2009-02-10 Thread Alex Mcauley

oops sorry my bad ... i posted the wrong function ...


Here is the correct one

$$('.cancel').each( function(element) {
alert($(element).next()); // returns undefined ?
alert($(element).next(0)); // returns undefined ?
alert($(element).next(1)); // returns undefined ?
alert($(element).down()); // returns undefined ?
alert($(element).down(0)); // returns undefined ?
alert($(element).down(1)); // returns undefined ?


});


Sorry

Thanks
Alex





- Original Message - 
From: "Walter Lee Davis" 
To: 
Sent: Tuesday, February 10, 2009 4:35 PM
Subject: [Proto-Scripty] Re: Possible prototype bug ?


>
> observe's function takes the event as the first argument, the element
> as the second. Change your function to
>
> function(evt,elm){
> alert(elm.next());
> }
>
> If you want to be very careful, you can do this:
>
> function(evt){
> var elm = Event.element(evt);
> alert(elm.next());
> }
>
>
> Walter
>
> On Feb 10, 2009, at 11:24 AM, Jeztah wrote:
>
>> how can this possibly be if the html is nowhere near the end of the
>> document ? .. its confusing the hell out of me, or am i missing the
>
>
> >
> 


--~--~-~--~~~---~--~~
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: Possible prototype bug ?

2009-02-10 Thread Walter Lee Davis

observe's function takes the event as the first argument, the element  
as the second. Change your function to

function(evt,elm){
alert(elm.next());
}

If you want to be very careful, you can do this:

function(evt){
var elm = Event.element(evt);
alert(elm.next());
}


Walter

On Feb 10, 2009, at 11:24 AM, Jeztah wrote:

> how can this possibly be if the html is nowhere near the end of the
> document ? .. its confusing the hell out of me, or am i missing the


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---