[Prototype-core] Re: $ function

2007-06-22 Thread Andrew Dupont
On Jun 21, 6:30 am, Rebecca Blyth [EMAIL PROTECTED] wrote: Finally, an aside on not having control over the HTML source: I ran into this issue when using the radio_button_tag helper method in Rails, which inconveniently used the name of the input as the id - unhelpful, as all the radio

[Prototype-core] Re: $ function

2007-06-22 Thread Tobie Langel
AFAIK, that's been corrected a long time ago - but I might be wrong. On Jun 22, 2:59 am, Andrew Dupont [EMAIL PROTECTED] wrote: On Jun 21, 6:30 am, Rebecca Blyth [EMAIL PROTECTED] wrote: Finally, an aside on not having control over the HTML source: I ran into this issue when using the

[Prototype-core] Re: bracket notation

2007-06-22 Thread Andrew Dupont
On Jun 21, 2:35 pm, sed [EMAIL PROTECTED] wrote: I'm not sure why this worked before, it must be related to the html/ script being generated into the div from the ajax.updater rather than just being on the page. Nope. It's sillier than that. Let's say you've got an element with an ID of foo

[Prototype-core] Re: bracket notation

2007-06-22 Thread Miha Zimin
Hi guys. I'm new in prototypejs and script.aculo. But, lets consider Andrew Dupont's example again: var f = new String(foo); alert($(f)) //- foo alert(document.getElementById('foo')) //- [object HTMLElement] It has cause: When String( ) is used as a constructor with the new operator, it

[Prototype-core] Re: bracket notation

2007-06-22 Thread Mislav Marohnić
On 6/22/07, Miha Zimin [EMAIL PROTECTED] wrote: Or it isn't good idea. What do you think? Leave it as it is. The String function/constructor is maybe useful for other things, but seldom for handling element IDs before passing them to the $ function. The current check is enough - it was enough

[Prototype-core] Re: bracket notation

2007-06-22 Thread Tobie Langel
The String function/constructor is maybe useful for other things [...] Like what exactly !? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype: Core group. To post to this group, send email to

[Prototype-core] Re: bracket notation

2007-06-22 Thread Mislav Marohnić
On 6/22/07, Tobie Langel [EMAIL PROTECTED] wrote: The String function/constructor is maybe useful for other things [...] Like what exactly !? Like when casting something to string when toString is not sufficient. I don't know when that may be. I was just stating this: although this may be

[Prototype-core] Re: bracket notation

2007-06-22 Thread jdalton
I don't see the harm in adding the second condition element instanceof String you could use : if(element element.constructor == String) This works for both foo and new String(foo); I find that it is faster than using typeOf. I have made very JavaScript heavy applications and noticed that

[Prototype-core] Re: bracket notation

2007-06-22 Thread Mislav Marohnić
On 6/22/07, jdalton [EMAIL PROTECTED] wrote: Also I don't buy the it hasn't been fixed since the beginning, so why fix it now? argument. Well, if in almost 2 years we have a first report about it only now, then it sounds like a big edge case to me.

[Prototype-core] Re: bracket notation

2007-06-22 Thread Mislav Marohnić
On 6/22/07, Tobie Langel [EMAIL PROTECTED] wrote: I'm actually getting faster results in Firefox for typeof in that particular case. Me too. Try it for yourself: http://gfx.neohub.com/benchmark/creator.html --~--~-~--~~~---~--~~ You received this message

[Prototype-core] Re: bracket notation

2007-06-22 Thread Tobie Langel
I'm actually getting faster results in Firefox for typeof in that particular case. On Jun 22, 8:55 am, jdalton [EMAIL PROTECTED] wrote: I don't see the harm in adding the second condition element instanceof String you could use : if(element element.constructor == String) This works for

[Prototype-core] Re: bracket notation

2007-06-22 Thread jdalton
If you run it more than once you get different results. Reguardless of this benchmark (I got it to show .constructor was faster consistently more times, IE) Its a method of detecting a string that will fix the issue. --~--~-~--~~~---~--~~ You received this

[Prototype-core] Re: bracket notation

2007-06-22 Thread jdalton
And using : http://gfx.neohub.com/benchmark/creator.html Firefox: slower by alot using constructor IE : faster by alot using constructor return ('hi'.constructor == String); vs return (typeof 'hi' == 'string'); IE: faster by alot using constructor Firefox : mixed (sometimes slower sometimes

[Prototype-core] Small Documentation Request - Enumerable.invoke

2007-06-22 Thread Ken Snyder
Hi Team, I just wanted to make a small documentation request for Enumerable.invoke. I discovered it useful that invoke returns the processed array of items. The docs specify that invoke returns an array, but it isn't clear that you can chain two invoke commands to call two methods in

[Prototype-core] Re: Small Documentation Request - Enumerable.invoke

2007-06-22 Thread Mislav Marohnić
Thanks. It's not obvious to all, so I added one of your examples to the doc. On 6/22/07, Ken Snyder [EMAIL PROTECTED] wrote: Hi Team, I just wanted to make a small documentation request for Enumerable.invoke. I discovered it useful that invoke returns the processed array of items. The

[Prototype-core] Re: Small Documentation Request - Enumerable.invoke

2007-06-22 Thread Ken Snyder
Mislav Marohnić wrote: Thanks. It's not obvious to all, so I added one of your examples to the doc. Awesome! That was faster than approving a wiki edit :P --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups