On Oct 4, 5:38 pm, surge <[email protected]> wrote: > I have this nasty problem with hashes. IE 8 disregards the order of > hash element declarations and when I do hash_name.each(), the result > is "out of order" so to speak -- although I know that the order is not > guaranteed. What's the best solution if I want to stay with hashes?
You said it yourself: The order is not guaranteed. It could change from one dot release of the browser to the next. If you need a specific order, you need to get the keys (Hash#keys[1]) and sort them (Array#sort[2]), then loop through them in their (now) sorted order. [1] http://api.prototypejs.org/language/Hash/prototype/keys/ [2] http://es5.github.com/#x15.4.4.11 -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com -- 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.
