[JSMentors] Re: Post/repo on small something to help with checking for object conformance

2011-03-23 Thread npup
On Mar 23, 2:35 am, Scott Sauyet scott.sau...@gmail.com wrote: There are still of course techniques that are more difficult with this style, but they are not as bad as I'd thought. Am I right that this style would be more difficult?:     var results1 = mismatch(spec1, obj1),        

Re: [JSMentors] Problem removing event listener?

2011-03-23 Thread Poetro
2011/3/22 Mark McDonnell mark.m...@gmail.com: I'm having a bizarre issue removing an event listener (this occurs in both Firefox and Chrome). If I run the following code via the console… document.getElementsByTagName('body')[0].addEventListener('click', function(e){ alert(e); }, false);

[JSMentors] Re: Best practices concerning references inside nested objects

2011-03-23 Thread pnbv
Thank you very much, your argumentation makes perfect sense. I find this type of discussions highly beneficial to the practice of this language. pedro On Mar 23, 2:17 pm, Luke Smith lsm...@lucassmith.name wrote: On Mar 23, 2011, at 6:43 AM, Poetro wrote: 2011/3/23 pnbv

Re: [JSMentors] Best practices concerning references inside nested objects

2011-03-23 Thread Luke Smith
On Mar 23, 2011, at 8:33 AM, Tony Wang wrote: Hi Smith , for my opinion , in your case var doSomething = app.doSomething; doSomething(); // boom if the 'this' references are left in tact. I think it's a fault for invoker, If I am developing with it , I will not forget to use call or apply

Re: [JSMentors] Best practices concerning references inside nested objects

2011-03-23 Thread Tony Wang
Hi Smith, if it's a util , it's better not to count on anthing , or at least only Constant class only. If in your case , app is kind of constant object , I could agree with you. But at least it's more clear when you wrote a doSomething.call(app), that means doSomething() need a app , that's the

[JSMentors] Re: Best practices concerning references inside nested objects

2011-03-23 Thread RobG
On Mar 23, 11:43 pm, Poetro poe...@gmail.com wrote: 2011/3/23 pnbv p.bacelar.vasconce...@gmail.com: Considering a single instance object: app = {    foo: 'afoo',    bar: 'abar',    callbackLib: {        replyFoo: function () {            console.log(this.foo);        },      

[JSMentors] Re: Problem removing event listener?

2011-03-23 Thread RobG
On Mar 24, 1:43 am, Poetro poe...@gmail.com wrote: jQuery adds a wrapper around callback functions, and also collects them to data object. It also adds a non-standard property so it can identify the element that it added the listener to (which in IE means also adding an HTML attribute).