On Nov 10, 2:21 pm, bcamp1973 <[EMAIL PROTECTED]> wrote:
[...]
>         initialize : function(elem) {
>                 this.input = elem;
>                 this.image = '<img src="assets/images/clear.gif"/>';
>                 this.checkbox;
----------------^
You don't really need this (as it doesn't declare anything)

>         this.convertInput();
>         this.registerEventListener();
>         }
>
>         ,convertInput : function() {
>                 if(!this.input.checked) {
>                         this.checkbox = this.input.wrap('div', { 'class': 
> 'checkbox' });
>                 } else {
>                         this.checkbox = this.input.wrap('div', { 'class': 
> 'checkbox
> checked' });

Could be made more concise like so (although it's a matter of taste):

this.checkbox = this.input.wrap('div', {
  'class': 'checkbox ' + (this.input.checked ? '' : 'checked')
})

>                 }
>                 this.checkbox.insert({ bottom: this.image });
>         }
>
>         ,registerEventListener : function() {
>                 Event.observe(this.checkbox, 'click', function() {
>                         this.toggleInput();
>                 });

-----------------------^
replace with:

this.checkbox.observe('click', this.toggleInput.bind(this));

(otherwise function is called within a global context - not within an
instance-object)

[...]

--
kangax
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to