Subj : Re: Retaining property order in Rhino To : Larry Blair From : Igor Bukanov Date : Wed Apr 30 2003 09:49 pm Larry Blair wrote: > Igor Bukanov wrote: > >> In principle as a workaround it should be possible to create a >> subclass of ScriptableObject that uses a linear search to look for >> properties but the longer term solution would be to fix the application. > > > I'm curious how subclassing would work. If I have "var x={a:b, c:d};" > how can I make "x" be a MyScriptableObject instead of a ScriptableObject. > var x={a:b, c:d} will call the current value of top-level Object property to construct new Object, so in principle if after calling Context.initStandardObjects you will override Object with a function that will create instances of your subclass, it would give you a work around without changing Rhino sources. But if you can afford to maintain your local changes to Rhino, you could alter ScriptableObject source to record property creation order and then sort over it in getIds implementation. It should be much simpler to code. Regards, Igor .