Karl,
Use of $break is not deprecated. Use of $continue is deprecated (just
use a return statement). But if you want to break the loop, you still
throw $break:
http://www.prototypejs.org/api/enumerable/each
--
T.J. Crowder
tj / crowder software / com
On Oct 4, 8:43 am, kstubs <[EMAIL PROTECTED]> wrote:
> I am iterating through an array, but it fails to break on the return
> statement. What is working, and is suppose to be deprecated is the
> throw $break. So, some example code:
>
> var pattern = obj.readAttribute('pattern').split('/');
>
> pattern.each(function(pat)
> {
> // make selection based on pattern
> if(obj.value.include(pat) )
> patternfound = true;
>
> if(patternfound)
> {
> obj.next().insert('found: ' + pat + '|');
> __selectString(obj, pat);
> return;
> }
> });
>
> So the obj.next, that is a span tag, and the output looks like:
> found: DD|found: YYYY|
>
> Which indicates that it finds all possible patterns, but should break
> on the first find of DD. When I replace the "return;" statement above
> with: throw $break, the code behaves as expected and I get the
> following output:
>
> found: DD|
>
> So what give? Any ideas on this?
>
> Karl..
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype: Core" 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-core?hl=en
-~----------~----~----~----~------~----~------~--~---