[Prototype-core] Re: methodize parseInt & parseFloat

2008-01-29 Thread kangax
This could be useful for parsing Element#getStyle results (to get rid of "px") parseInt(element.getStyle('left')); // vs. element.getStyle('left').parseInt(); I don't think it's a significant difference though. Moreover, getStyle could return null and we all know what happens then. Speaking abou

[Prototype-core] Re: methodize parseInt & parseFloat

2008-01-29 Thread Gareth Evans
I'd like to see it make it into the framework but if I have to add it to extensions.js (my 'extra' methods for prototype) then its not the end of the world. On Jan 30, 2008 1:01 PM, Mislav Marohnić <[EMAIL PROTECTED]> wrote: > On Jan 30, 2008 12:01 AM, Andrew Dupont <[EMAIL PROTECTED]> wrote: >

[Prototype-core] Re: methodize parseInt & parseFloat

2008-01-29 Thread Mislav Marohnić
On Jan 30, 2008 12:01 AM, Andrew Dupont <[EMAIL PROTECTED]> wrote: > > In ECMAScript 4, parseInt and parseFloat are becoming static methods > on Number, not on String (i.e., Number.parseInt("3")). I could more > easily see adding String#toNumber, but it's not a must-have for me. > What do others t

[Prototype-core] Re: methodize parseInt & parseFloat

2008-01-29 Thread Andrew Dupont
On Jan 29, 3:41 am, "artemy tregoubenko" <[EMAIL PROTECTED]> wrote: > Well, I'm using this one: > Object.extend(String.prototype, { >         parseInt: parseInt.methodize(), >         parseFloat: parseFloat.methodize(), > > }); > Clever. :-) In ECMAScript 4, parseInt and parseFloat are becomin

[Prototype-core] Re: NPE in Element.remove

2008-01-29 Thread Zmitro Lapcjonak
On Jan 25, 5:38 pm, Zmitro Lapcjonak <[EMAIL PROTECTED]> wrote: > Element.Methods = { > ... > remove: function(element) { >element = $(element); >element.parentNode.removeChild(element); >return element;}, Let me explain in details: I use var _win = null; // global var for window fu

[Prototype-core] Re: methodize parseInt & parseFloat

2008-01-29 Thread artemy tregoubenko
Well, I'm using this one: Object.extend(String.prototype, { parseInt: parseInt.methodize(), parseFloat: parseFloat.methodize(), }); I thought this could be useful for someone else. > > I have been using methods for parseInt for a while. You simply call > 'string'.to_i(); > > // b

[Prototype-core] Re: methodize parseInt & parseFloat

2008-01-29 Thread redheat
Woops, the code should be: return parseInt(this, 10); I stripped out some code and forgot about this. On Jan 29, 9:34 am, redheat <[EMAIL PROTECTED]> wrote: > I have been using methods for parseInt for a while. You simply call > 'string'.to_i(); > > // by encapsulating this code in an anonymous f

[Prototype-core] Re: methodize parseInt & parseFloat

2008-01-29 Thread redheat
I have been using methods for parseInt for a while. You simply call 'string'.to_i(); // by encapsulating this code in an anonymous function, we can avoid intrusion upon the global namespace (function() { var _ruby_methods = { to_i: function() { // helper function for parse