p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Register | 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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 22nd, 2006, 08:58 AM
Registered User
 
Join Date: Aug 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Why is this method placed in

On p.464 In Professional javascript:

oXmlDom.parseError = {
valueOf: function () { return this.errorCode; },
toString: function () { return this.errorCode.toString() }
};


Why is this object defined in the XmlDom() constructor after the oXmlDom object has been instantiated?

Why not just defined it like this:

Document.prototype.parseError = {
valueOf: function () { return this.errorCode; },
toString: function () { return this.errorCode.toString() }
};


Please someone must answer

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old August 25th, 2006, 10:40 PM
nzakas's Avatar
Wrox Author
Points: 647, Level: 9
Points: 647, Level: 9 Points: 647, Level: 9 Points: 647, Level: 9
Activity: 2%
Activity: 2% Activity: 2% Activity: 2%
 
Join Date: Dec 2004
Location: Peabody, MA, USA.
Posts: 192
Thanks: 0
Thanked 2 Times in 2 Posts
Default

If you were to do it your way, the same parseError object would be used for every instance of an XML Document, meaning that you would never know which DOM object it referred to.

The parseError object has to be created after the XML DOM object has been created to make sure it refers just to that object.

Nicholas C. Zakas
Author, Professional JavaScript for Web Developers (ISBN 0764579088)
http://www.nczonline.net/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
About Method VeradisSanthanam ASP.NET 2.0 Basics 1 June 19th, 2007 07:52 AM
method amit_p_patel VB How-To 2 May 25th, 2007 02:46 AM
Required method? budman Pro JSP 2 July 1st, 2006 08:39 PM
Best method rastham SQL Server 2000 2 February 16th, 2006 12:59 AM
Method StanArtis BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 1 December 6th, 2004 06:09 AM



All times are GMT -4. The time now is 02:11 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc