Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0
This is the forum to discuss the Wrox book Professional JavaScript for Web Developers by Nicholas C. Zakas; ISBN: 9780764579080
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 3rd, 2006, 08:17 PM
AGS AGS is offline
Wrox Technical Editor
Points: 267, Level: 5
Points: 267, Level: 5 Points: 267, Level: 5 Points: 267, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2005
Location: Russia
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default Resolution of property names on window object

I have a question regarding resolution of property names on global object (window object in case of browser hosting environment).

Lets say we have a global variable with the same name as property of a window object.
Code:
var location = "Test";
Global variable is in fact a property of global object (window). So having declared global variable location we cannot access original window.location property anymore.

As far as I know there is no way to access original property of window in this case but maybe someone has a clue?

Interestingly enough it seems that in Firefox window’s property takes precedence over global variable of the same name and for example var location = "Test.html" changes current location.


__________________
Alexey Gorkov
Reply With Quote
  #2 (permalink)  
Old August 4th, 2006, 04:57 PM
nzakas's Avatar
Wrox Author
 
Join Date: Dec 2004
Location: Peabody, MA, USA.
Posts: 217
Thanks: 0
Thanked 5 Times in 5 Posts
Default

You'd only be able to access it if you had saved a reference to the original before creating your own variable.

Nicholas C. Zakas
Author, Professional JavaScript for Web Developers (ISBN 0764579088)
http://www.nczonline.net/
Reply With Quote
  #3 (permalink)  
Old August 4th, 2006, 06:18 PM
AGS AGS is offline
Wrox Technical Editor
Points: 267, Level: 5
Points: 267, Level: 5 Points: 267, Level: 5 Points: 267, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2005
Location: Russia
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Nicholas, that's all I wanted to know.
But what about Firefox? Does its implementation seem logical for you?

Reply With Quote
  #4 (permalink)  
Old August 5th, 2006, 11:50 AM
nzakas's Avatar
Wrox Author
 
Join Date: Dec 2004
Location: Peabody, MA, USA.
Posts: 217
Thanks: 0
Thanked 5 Times in 5 Posts
Default

I'm not sure I'd call it "logical". It seems to go against the theory that you may want to override some previously defined variable.

Nicholas C. Zakas
Author, Professional JavaScript for Web Developers (ISBN 0764579088)
http://www.nczonline.net/
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
dynamic variable/object names TheBFJ Excel VBA 2 November 13th, 2006 07:11 AM
Refreshing Property Window? Kaprice Visual Studio 2005 11 November 11th, 2006 08:49 PM
Arranging controls according to window resolution bijgupt VB.NET 2002/2003 Basics 0 June 7th, 2006 03:47 AM
Blank Property window... aoskayak BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 3 May 5th, 2006 11:26 AM
Window Names panos Javascript How-To 2 February 10th, 2006 11:33 AM



All times are GMT -4. The time now is 08:57 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.