On Jul 15, 9:41 am, keemor <kee...@gmail.com> wrote:
> Thanks for this tip, I didnt know that
>
> What about this fragment:
>  xhrRequestFake: function(e){
>                //now "this" is a <li> which I want to use to read id
> from
>                 itemManager.json = [{'key':'no'},{'key':'way!'}];
>                 itemManager.createHTML();
>
> }
>
> Is it a good practice to call method like this itemManager.createHTML
> (); instead of  this.createHTML(); if I want to preserve 'this' as a
> context of element from the event?
>

I'm not quite sure what you are asking.
Inside a function 'this' always refers to the global object (the
window) unless you have taken steps to make it refer to something
else. A common way to make it refer to something else is by calling
the function as a method (your 'itemManager.createHTML()'). Prototype
provides another way in Function.bind.

So if you use ItemManager.createHTML(), inside 'createHTML', 'this'
will refer to ItemManager.  But as far as I can see, you are not using
'this' inside 'createHTML' anyway, so the question is irrelevant.

--~--~---------~--~----~------------~-------~--~----~
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 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to