[Proto-Scripty] Re: Prototype.jExtension
Which methods you propose for the library are entirely up to you. The development team will make the ultimate decision if they want to include them or make efficiency modifications. i was just offering a tweak to #compact to make it work as described. :) Good luck! -joe t. On Nov 13, 12:19 pm, jacoz jacopo.nu...@gmail.com wrote: Hi Joe T., well, I've followed your suggests and so (I remember you the linkhttp://tr.im/EBEP): - updated Array#compact - updated Element#ajaxRequest - added Element#ajaxUpdate So now you have an empty function when using #ajaxRequest, and the update function when using #ajaxUpdate! Is that good, according to you? Which methods would you suggest me to propose? Thank you so much! Jacopo. On Nov 13, 4:49 pm, joe t. thooke...@gmail.com wrote: i agree with a lot of Eric's points so far. There are some interesting, and possibly useful utility methods in this, but there are others that would needlessly bloat an already fairly bloated library (don't get me wrong, i still love it). The thing i would point out for #ajaxRequest is similar to Eric's point: by embedding an onSuccess call, you force the user to either replace it with their own callback, or pass an empty function just to make it not do the default element update. It's usually better practice to minimize the amount of required options and let the user include more as they need them. i actually don't do element updates from Ajax request as a frequent practice, so this modification would harm my code overhead. Also, as a minor clarification: in #compact, the strict argument name should be changed to aggressive. ( ) is not strictly an empty string. It's just 100% white space. Seems like nitpicking, but with other mentions of helping novice coders understand more about JS libraries, consistent semantics are a huge part of that. Eric's right about using tests outside loops, but there are a couple issue with the proposed correction: 1. From the original, value.strip() is wrong, because #strip() doesn't exist for non-string values. 2. Several values are false-ish, so they get removed from the results even without the aggressive argument. If the intent of this #compact method is to only remove null/undefined in lazy mode, Prototype.K won't work. Returning to the select() comparison ends up false, so gets dropped. Suggested: compact(aggressive){ return this.select(aggressive === true ? function(v){return v != null v.toString().strip() != ''} : function(v){return v !== null v !== undefined} ) } The adjustment ensures that the intent of only stripping null and undefined remains intact, since so many values can evaluate to false- ish (, 0, [], etc). And mentioning zero, what if there's desire to be super-aggressive and remove those, or also remove actual boolean falses? :) -joe t. On Nov 13, 8:07 am, Eric lefauv...@gmail.com wrote: Hi Jacopo, On Nov 12, 4:29 pm, jacoz jacopo.nu...@gmail.com wrote: Hi Eric, thanks for your suggests! Well, now I answer all of your questions ;) - I named Element.ajaxRequest() in that way because by default it updates the element, but you can change the onSuccess function! OK, but if you don't change the element in the onSuccess, there is no point using this method instead of Ajax.Request. - I've written String#len and String#getType because some newbies may not knows that attributes ;) Well, you must not forget that every single byte you add to the library will be loaded by every single page using the library. Peoples are already complaining because prototype is big, so if we start to add useless things, it will be worst. Moreover, newbies should better learn about length and the DOM attributes instead of some exotic name not portable (and slower) methods - I've re-written Array#compact: now the control is not recursive It wasn't recursive, it was slow :o) But still, return value != null is the same than return value (at least when passed to Enumerable.select) and it is exactly what Prototype.K function does. (thanks) Here is the code:http://tr.im/EBEPtheArray#comapctstartsat at line 128 Which methods do you suggest me to propose?? Well it is up to you, but Element.ajaxUpdate, Object.isBoolean or your change to Array.compact sounds like useful features to me. Eric Thanks, Jacopo. On Nov 12, 11:15 am, Eric lefauv...@gmail.com wrote: Hi, This has some nice ideas like Element.ajaxRequest() (which I would have called Element.ajaxUpdate() since it is what it does :o) ), but also some features I fail to see any utility to. I.E., what's the point to use 'string'.len() instead of 'string'.length? Same thing for $('someElement').getType() instead of $ ('someElement').nodeName Also, try to limit the impact on
[Proto-Scripty] Re: Prototype.jExtension
Hi Jacopo, On Nov 12, 4:29 pm, jacoz jacopo.nu...@gmail.com wrote: Hi Eric, thanks for your suggests! Well, now I answer all of your questions ;) - I named Element.ajaxRequest() in that way because by default it updates the element, but you can change the onSuccess function! OK, but if you don't change the element in the onSuccess, there is no point using this method instead of Ajax.Request. - I've written String#len and String#getType because some newbies may not knows that attributes ;) Well, you must not forget that every single byte you add to the library will be loaded by every single page using the library. Peoples are already complaining because prototype is big, so if we start to add useless things, it will be worst. Moreover, newbies should better learn about length and the DOM attributes instead of some exotic name not portable (and slower) methods - I've re-written Array#compact: now the control is not recursive It wasn't recursive, it was slow :o) But still, return value != null is the same than return value (at least when passed to Enumerable.select) and it is exactly what Prototype.K function does. (thanks) Here is the code:http://tr.im/EBEPthe Array#comapct starts at at line 128 Which methods do you suggest me to propose?? Well it is up to you, but Element.ajaxUpdate, Object.isBoolean or your change to Array.compact sounds like useful features to me. Eric Thanks, Jacopo. On Nov 12, 11:15 am, Eric lefauv...@gmail.com wrote: Hi, This has some nice ideas like Element.ajaxRequest() (which I would have called Element.ajaxUpdate() since it is what it does :o) ), but also some features I fail to see any utility to. I.E., what's the point to use 'string'.len() instead of 'string'.length? Same thing for $('someElement').getType() instead of $ ('someElement').nodeName Also, try to limit the impact on performances by avoiding tests in loops when you can do them outside of the loop. I.E, in your Array.compact version, you may replace : compact: function(strict) { return this.select(function(value) { return strict === true ? value != null value.strip() != '' : value != null; });} ...by something like: compact: function(strict) { return this.select(strict === true ? function(value) { return value != null value.strip() != '' } : Prototype.K);} The procedure to submit contributions is described here:http://www.prototypejs.org/contribute You may propose some of yours (I'd recommend proposing only the more interesting methods) once you've validated that they don't break the test cases. HTH, Eric On Nov 10, 10:07 am, Jacopo Andrea Nuzzi jacopo.nu...@gmail.com wrote: Hi Tobie, thanks for you suggest: here it is:http://tr.im/EBEP Jacopo On Mon, Nov 9, 2009 at 9:35 PM, Tobie Langel tobie.lan...@gmail.com wrote: Hi jacoz, Seems like your Array#add would benefit from using Array#splice. https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Object... Best, Tobie --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Prototype.jExtension
i agree with a lot of Eric's points so far. There are some interesting, and possibly useful utility methods in this, but there are others that would needlessly bloat an already fairly bloated library (don't get me wrong, i still love it). The thing i would point out for #ajaxRequest is similar to Eric's point: by embedding an onSuccess call, you force the user to either replace it with their own callback, or pass an empty function just to make it not do the default element update. It's usually better practice to minimize the amount of required options and let the user include more as they need them. i actually don't do element updates from Ajax request as a frequent practice, so this modification would harm my code overhead. Also, as a minor clarification: in #compact, the strict argument name should be changed to aggressive. () is not strictly an empty string. It's just 100% white space. Seems like nitpicking, but with other mentions of helping novice coders understand more about JS libraries, consistent semantics are a huge part of that. Eric's right about using tests outside loops, but there are a couple issue with the proposed correction: 1. From the original, value.strip() is wrong, because #strip() doesn't exist for non-string values. 2. Several values are false-ish, so they get removed from the results even without the aggressive argument. If the intent of this #compact method is to only remove null/undefined in lazy mode, Prototype.K won't work. Returning to the select() comparison ends up false, so gets dropped. Suggested: compact(aggressive){ return this.select(aggressive === true ? function(v){return v != null v.toString().strip() != ''} : function(v){return v !== null v !== undefined} ) } The adjustment ensures that the intent of only stripping null and undefined remains intact, since so many values can evaluate to false- ish (, 0, [], etc). And mentioning zero, what if there's desire to be super-aggressive and remove those, or also remove actual boolean falses? :) -joe t. On Nov 13, 8:07 am, Eric lefauv...@gmail.com wrote: Hi Jacopo, On Nov 12, 4:29 pm, jacoz jacopo.nu...@gmail.com wrote: Hi Eric, thanks for your suggests! Well, now I answer all of your questions ;) - I named Element.ajaxRequest() in that way because by default it updates the element, but you can change the onSuccess function! OK, but if you don't change the element in the onSuccess, there is no point using this method instead of Ajax.Request. - I've written String#len and String#getType because some newbies may not knows that attributes ;) Well, you must not forget that every single byte you add to the library will be loaded by every single page using the library. Peoples are already complaining because prototype is big, so if we start to add useless things, it will be worst. Moreover, newbies should better learn about length and the DOM attributes instead of some exotic name not portable (and slower) methods - I've re-written Array#compact: now the control is not recursive It wasn't recursive, it was slow :o) But still, return value != null is the same than return value (at least when passed to Enumerable.select) and it is exactly what Prototype.K function does. (thanks) Here is the code:http://tr.im/EBEPtheArray#comapct starts at at line 128 Which methods do you suggest me to propose?? Well it is up to you, but Element.ajaxUpdate, Object.isBoolean or your change to Array.compact sounds like useful features to me. Eric Thanks, Jacopo. On Nov 12, 11:15 am, Eric lefauv...@gmail.com wrote: Hi, This has some nice ideas like Element.ajaxRequest() (which I would have called Element.ajaxUpdate() since it is what it does :o) ), but also some features I fail to see any utility to. I.E., what's the point to use 'string'.len() instead of 'string'.length? Same thing for $('someElement').getType() instead of $ ('someElement').nodeName Also, try to limit the impact on performances by avoiding tests in loops when you can do them outside of the loop. I.E, in your Array.compact version, you may replace : compact: function(strict) { return this.select(function(value) { return strict === true ? value != null value.strip() != '' : value != null; });} ...by something like: compact: function(strict) { return this.select(strict === true ? function(value) { return value != null value.strip() != '' } : Prototype.K);} The procedure to submit contributions is described here:http://www.prototypejs.org/contribute You may propose some of yours (I'd recommend proposing only the more interesting methods) once you've validated that they don't break the test cases. HTH, Eric On Nov 10, 10:07 am, Jacopo Andrea Nuzzi jacopo.nu...@gmail.com wrote: Hi Tobie, thanks for you suggest: here it is:http://tr.im/EBEP Jacopo On Mon, Nov 9, 2009
[Proto-Scripty] Re: Prototype.jExtension
Hi Joe T., well, I've followed your suggests and so (I remember you the link http://tr.im/EBEP): - updated Array#compact - updated Element#ajaxRequest - added Element#ajaxUpdate So now you have an empty function when using #ajaxRequest, and the update function when using #ajaxUpdate! Is that good, according to you? Which methods would you suggest me to propose? Thank you so much! Jacopo. On Nov 13, 4:49 pm, joe t. thooke...@gmail.com wrote: i agree with a lot of Eric's points so far. There are some interesting, and possibly useful utility methods in this, but there are others that would needlessly bloat an already fairly bloated library (don't get me wrong, i still love it). The thing i would point out for #ajaxRequest is similar to Eric's point: by embedding an onSuccess call, you force the user to either replace it with their own callback, or pass an empty function just to make it not do the default element update. It's usually better practice to minimize the amount of required options and let the user include more as they need them. i actually don't do element updates from Ajax request as a frequent practice, so this modification would harm my code overhead. Also, as a minor clarification: in #compact, the strict argument name should be changed to aggressive. ( ) is not strictly an empty string. It's just 100% white space. Seems like nitpicking, but with other mentions of helping novice coders understand more about JS libraries, consistent semantics are a huge part of that. Eric's right about using tests outside loops, but there are a couple issue with the proposed correction: 1. From the original, value.strip() is wrong, because #strip() doesn't exist for non-string values. 2. Several values are false-ish, so they get removed from the results even without the aggressive argument. If the intent of this #compact method is to only remove null/undefined in lazy mode, Prototype.K won't work. Returning to the select() comparison ends up false, so gets dropped. Suggested: compact(aggressive){ return this.select(aggressive === true ? function(v){return v != null v.toString().strip() != ''} : function(v){return v !== null v !== undefined} ) } The adjustment ensures that the intent of only stripping null and undefined remains intact, since so many values can evaluate to false- ish (, 0, [], etc). And mentioning zero, what if there's desire to be super-aggressive and remove those, or also remove actual boolean falses? :) -joe t. On Nov 13, 8:07 am, Eric lefauv...@gmail.com wrote: Hi Jacopo, On Nov 12, 4:29 pm, jacoz jacopo.nu...@gmail.com wrote: Hi Eric, thanks for your suggests! Well, now I answer all of your questions ;) - I named Element.ajaxRequest() in that way because by default it updates the element, but you can change the onSuccess function! OK, but if you don't change the element in the onSuccess, there is no point using this method instead of Ajax.Request. - I've written String#len and String#getType because some newbies may not knows that attributes ;) Well, you must not forget that every single byte you add to the library will be loaded by every single page using the library. Peoples are already complaining because prototype is big, so if we start to add useless things, it will be worst. Moreover, newbies should better learn about length and the DOM attributes instead of some exotic name not portable (and slower) methods - I've re-written Array#compact: now the control is not recursive It wasn't recursive, it was slow :o) But still, return value != null is the same than return value (at least when passed to Enumerable.select) and it is exactly what Prototype.K function does. (thanks) Here is the code:http://tr.im/EBEPtheArray#comapctstarts at at line 128 Which methods do you suggest me to propose?? Well it is up to you, but Element.ajaxUpdate, Object.isBoolean or your change to Array.compact sounds like useful features to me. Eric Thanks, Jacopo. On Nov 12, 11:15 am, Eric lefauv...@gmail.com wrote: Hi, This has some nice ideas like Element.ajaxRequest() (which I would have called Element.ajaxUpdate() since it is what it does :o) ), but also some features I fail to see any utility to. I.E., what's the point to use 'string'.len() instead of 'string'.length? Same thing for $('someElement').getType() instead of $ ('someElement').nodeName Also, try to limit the impact on performances by avoiding tests in loops when you can do them outside of the loop. I.E, in your Array.compact version, you may replace : compact: function(strict) { return this.select(function(value) { return strict === true ? value != null value.strip() != '' : value != null; });} ...by something like: compact: function(strict) { return this.select(strict === true ?
[Proto-Scripty] Re: Prototype.jExtension
Hi, This has some nice ideas like Element.ajaxRequest() (which I would have called Element.ajaxUpdate() since it is what it does :o) ), but also some features I fail to see any utility to. I.E., what's the point to use 'string'.len() instead of 'string'.length? Same thing for $('someElement').getType() instead of $ ('someElement').nodeName Also, try to limit the impact on performances by avoiding tests in loops when you can do them outside of the loop. I.E, in your Array.compact version, you may replace : compact: function(strict) { return this.select(function(value) { return strict === true ? value != null value.strip() != '' : value != null; });} ...by something like: compact: function(strict) { return this.select(strict === true ? function(value) { return value != null value.strip() != '' } : Prototype.K);} The procedure to submit contributions is described here: http://www.prototypejs.org/contribute You may propose some of yours (I'd recommend proposing only the more interesting methods) once you've validated that they don't break the test cases. HTH, Eric On Nov 10, 10:07 am, Jacopo Andrea Nuzzi jacopo.nu...@gmail.com wrote: Hi Tobie, thanks for you suggest: here it is:http://tr.im/EBEP Jacopo On Mon, Nov 9, 2009 at 9:35 PM, Tobie Langel tobie.lan...@gmail.com wrote: Hi jacoz, Seems like your Array#add would benefit from using Array#splice. https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Object... Best, Tobie --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Prototype.jExtension
i've shorten the url... here it is: http://j.mp/WM2uR sorry! On Nov 9, 3:29 pm, speedpac...@gmail.com speedpac...@gmail.com wrote: I'm getting a 403 :( On Nov 9, 11:19 am, jacoz jacopo.nu...@gmail.com wrote: Hi, I want you to show my extension of your framework. If you want you can take a look at it (http://app.jaydns.com/ prototype.jextension/prototype.jextension.js) and if you're interested in you may also uso some of that features in your next release! :) Jacopo. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Prototype.jExtension
Hi Tobie, thanks for you suggest: here it is: http://tr.im/EBEP Jacopo On Mon, Nov 9, 2009 at 9:35 PM, Tobie Langel tobie.lan...@gmail.com wrote: Hi jacoz, Seems like your Array#add would benefit from using Array#splice. https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/splice Best, Tobie --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Prototype.jExtension
I'm getting a 403 :( On Nov 9, 11:19 am, jacoz jacopo.nu...@gmail.com wrote: Hi, I want you to show my extension of your framework. If you want you can take a look at it (http://app.jaydns.com/ prototype.jextension/prototype.jextension.js) and if you're interested in you may also uso some of that features in your next release! :) Jacopo. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Prototype.jExtension
ditto - sounds interesting, let us know when it's up! -Andy -- From: speedpac...@gmail.com Sent: Monday, November 09, 2009 8:29 AM To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com Subject: [Proto-Scripty] Re: Prototype.jExtension I'm getting a 403 :( On Nov 9, 11:19 am, jacoz jacopo.nu...@gmail.com wrote: Hi, I want you to show my extension of your framework. If you want you can take a look at it (http://app.jaydns.com/ prototype.jextension/prototype.jextension.js) and if you're interested in you may also uso some of that features in your next release! :) Jacopo. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Prototype.jExtension
Hi jacoz, Seems like your Array#add would benefit from using Array#splice. https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/splice Best, Tobie --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---