I would start by using a JavaScript library to build applications, but as
you do so try and understand what the library is doing. Actually
understanding what a library is doing will put you well on your way to
becoming a DOM master. Not all of the patterns found in libraries are good
practices to follow though, so its good to be reading books like The Good
Parts, a quick perusal through Amazon should bring up the best titles for
JavaScript, if you read the reviews you'll get a general sense about what
you should be doing next.

On Mon, Jun 13, 2011 at 1:52 PM, radiate <[email protected]> wrote:

> All - Thanks all for your help.  I think I have the classic case of
> not being able to see the forest from the trees-in this case I'm
> delving into the syntactical technicalities vs how you use the
> language to solve real-world problems. Are there any recommended books
> out there that will help walk through creating client-side application
> development using javascript's oo approach?  Right now I'm reading
> Javascript: The Good Parts and hope to start reading The Definitive
> Guide but I'm assuming these are more about the syntax of Javascript
> and not about practical application.
>
> Thanks again!
>
>
>
> On Jun 13, 11:49 am, Angus Croll <[email protected]> wrote:
> > To add to what Peter said, the 'prototype' property referes to the
> > prototype that a constructor function will apply to instances that it
> > creates. HTML elements are not created by constructors (at least not
> > in any way that you have access to) so your approach is not feasible.
> >
> > One way is to create pick wrapper objects from a Pick constructor.
> > Each new pick object will reference the DOM object of the pick cell.
> > But to be honest for the effort involved I would say the advantages of
> > using prototype here are minimal.
> >
> > I would simply create a helper function called editInline or
> > something, which took your pick element as an argument and toggled it
> > back and forth between read only and editable state. There are quite a
> > few examples of this kind of utility in the existing JavaScript
> > framework
> >
> > Angus
> >
> > On Jun 13, 3:29 am, Peter van der Zee <[email protected]> wrote:
> >
> >
> >
> > > On Mon, Jun 13, 2011 at 5:44 AM, radiate <[email protected]>
> wrote:
> > > > Not sure if I misunderstood the purpose the prototype object of a
> > > > javascript object but I wanted to add functionality to an HTML Table
> > > > Cell that would generate a text box if a user clicked on the cell.  I
> > > > wanted to provide this functionality to all table cells in the table.
> > > > I thought this would be a good use of the prototype functionality in
> > > > Javascript.  It seems like I can't get it to work.  Here's the code:
> >
> > > Well, there are two reasons it's not really working or going to work
> like that.
> >
> > > For one, in order to extend an object through prototype you have to
> > > extend the parent object's prototype property, not that of the child.
> > > So.. if person is a child of Person:
> >
> > > person.prototype.newMethod = function(){}; // NOT
> > > Person.prototype.newMethod = function(){}; // YES
> >
> > > Note that the .prototype property of an instance (person) does not
> > > refer to "its prototype object", or Person.prototype. Formally you
> > > have no access to it through an instance but in most (not all!)
> > > browsers you can still find it through .__proto__ .
> >
> > > The other reason results might vary is because dom nodes are
> > > implemented using so called "host objects". These are special kinds of
> > > objects that typically don't adhere to the general rules of js. That
> > > means that in most cases, they behave as regular objects insofar as
> > > accessing properties go (and not even that, really) but extending them
> > > or creating new instances of them is all left up to the
> > > implementation. Pretty much any object related to the DOM is a host
> > > object.
> >
> > > - peter- Hide quoted text -
> >
> > - Show quoted text -
>
> --
> To view archived discussions from the original JSMentors Mailman list:
> http://www.mail-archive.com/[email protected]/
>
> To search via a non-Google archive, visit here:
> http://www.mail-archive.com/[email protected]/
>
> To unsubscribe from this group, send email to
> [email protected]
>

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to