Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #18029

Re: Request for opinions on my newbie approach

From "Leonardo Azpurua" <leonardo@exmvps.org>
Newsgroups comp.lang.javascript
Subject Re: Request for opinions on my newbie approach
Date 2013-01-08 23:34 -0430
Organization A noiseless patient Spider
Message-ID <kcipvf$ifh$1@dont-email.me> (permalink)
References <kcilrc$vt8$1@dont-email.me> <10136443.OnBuAidq6I@PointedEars.de>

Show all headers | View raw


"Thomas 'PointedEars' Lahn" <PointedEars@web.de> escribió en el mensaje 
news:10136443.OnBuAidq6I@PointedEars.de...
> Leonardo Azpurua wrote:
>
> These languages (on the client-side) so far use prototype-based 
> inheritance
> only.  There are no classes.  "Object type" appears to be the term that 
> fits
> best as it is used in the ECMAScript Specification.
>

Thanks... I was in doubt as to how to name these things.

>>     for (var i = 0; i < f.elements.length; i++)
>
>      for (var i = 0, len = f.elements.length; i < len; ++i)

Yup...

>
>>     {
>>        var e = f.elements[i];
>>        this[e.id] = e;
>
> Not a good idea.  Keep in mind that
>
>  1. not all form controls (need to) have an ID;
>  2. your wrapper object has other properties at that level that could be
>     overwritten if a form control has the same

Since that library is basically for my own use, and my "standard" requires 
that every meaningful HTML element has an id, and that every id is unique 
within the file, it doesn't sem to be a problem.

> Unless you also wrap the child controls, you do not need this loop.
>
>>        this.addEventHandler(e, "blur");
>>        this.addEventHandler(e, "focus");

Wrapping the controls is the next step. This was just to practically 
validate the approach.

> This does not make sense as it is.  You will not always have listeners for
> those events.
>
> Also, addEventListener() does _not_ (always) throw exceptions if the event
> listener cannot be added.  (A fundamental API design flaw if you ask me.)
> It only throws an exception in some implementations on some environments
> with some event types if the event type is not supported; but that is non-
> standard behavior (which is due to another fundamental API design flaw).

Ok. I have to test the code with different browsers.

I'll try to take a look at JSX in order to get a better grasp on the 
subject.

Thanks!

--

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Request for opinions on my newbie approach "Leonardo Azpurua" <leonardo@exmvps.org> - 2013-01-08 22:24 -0430
  Re: Request for opinions on my newbie approach Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-01-09 04:31 +0100
    Re: Request for opinions on my newbie approach "Leonardo Azpurua" <leonardo@exmvps.org> - 2013-01-08 23:34 -0430
      Re: Request for opinions on my newbie approach Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-01-09 05:14 +0100
    Re: Request for opinions on my newbie approach Jim T. <x@y.z> - 2013-01-09 14:32 -0500
      Re: Request for opinions on my newbie approach Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2013-01-09 20:41 +0100
        Re: Request for opinions on my newbie approach Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-01-09 21:03 +0100
        Re: Request for opinions on my newbie approach Jim T. <x@y.z> - 2013-01-09 15:11 -0500
        Re: Request for opinions on my newbie approach Luc Yen <luc@goal.tw> - 2013-01-09 14:38 -0800
      Re: Request for opinions on my newbie approach "Leonardo Azpurua" <leonardo@exmvps.org> - 2013-01-09 18:10 -0430
        Re: Request for opinions on my newbie approach Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-01-10 01:36 +0100

csiph-web