Subj : scope aliases To : netscape.public.mozilla.jseng From : Stuart Date : Sat Sep 04 2004 12:34 pm Hi, Earlier I asked some questions regarding scopes, now that I have worked with them some more I have a couple more questions. (1) Can a scope alias be renamed? e.g. If initially I set the alias of myScope to "document": ScriptableObject.putProperty(myScope, "document", myScope); In some circumstances I need to temporarily alias the above scope as "application" ScriptableObject.deleteProperty(myScope, "document"); ScriptableObject.putProperty(myScope, "application", myScope); Will any vars defined keep their values after the 're-name'? --> As an after thought it would be even better if myScope could be shallow copied so that I could have two scopes one aliased as "document" the other as "application" (but internally they have the same information and if I change document.x=5 then application.x will also equal 5) - Is this possible? (FYI: I can live with just re-name, I'm just being lazy!) (2) Apparently in ECMAScript "document.x" is an illegal variable name (e.g. var document.x). Is this correct? If I had a scope aliased as "document" and a var called x, I could use the 'variable name' "document.x" in my script e.g. document.x = 5 Assuming this is correct. If I wanted to define the following variable names in document scope how can it be done e.g. user.first (so this could be referenced as document.user.first or simply as user.first) user.last " user.age " Based on what ECMAScript says is an illegal variable name I'm assuming I could not use: ScriptableObject.defineProperty(docScope, "user.first", "Bob", 0); Your help will be much appreciated. Cheers, Stuart .