[mochikit] Re: New INPUT short-hand functions?

2008-01-22 Thread machineghost
So it took awhile, but I finally got around to completing my revised INPUT short-hand functions. They can be used as follows: CHECKBOX() // equivalent to: INPUT({type:checkbox}); CHECKBOX(object) // equivalent to: update(object, {type:checkbox}); INPUT(object); CHECKBOX(someString) //

[mochikit] Re: New INPUT short-hand functions?

2007-12-18 Thread machineghost
Thanks Kevin and Bob (I totally forgot about merge), but I agree that trying to use Mochikit to further simplify this pretty simple function is a bit overkill. Also thanks Morten; I totally forgot to account for the cases you mentioned. However, I disagree with you on the case-naming of

[mochikit] Re: New INPUT short-hand functions?

2007-12-17 Thread Kevin Damm
Maybe use MochiKit.Base.merge or MochiKit.Base.update: function CHECKBOX() { return INPUT.apply(this, update(arguments, {'type': checkbox})); } - Kevin On Dec 17, 2007 1:30 PM, machineghost [EMAIL PROTECTED] wrote: I recently found myself doing this a lot: var a =

[mochikit] Re: New INPUT short-hand functions?

2007-12-17 Thread Kevin Damm
Oops, that should probably be arguments[0] On Dec 17, 2007 2:00 PM, Kevin Damm [EMAIL PROTECTED] wrote: Maybe use MochiKit.Base.merge or MochiKit.Base.update: function CHECKBOX() { return INPUT.apply(this, update(arguments, {'type': checkbox})); } - Kevin On Dec 17, 2007 1:30 PM,

[mochikit] Re: New INPUT short-hand functions?

2007-12-17 Thread Kevin Damm
Good point, and yeah - I hadn't considered needing to pass the other arguments to apply(). You're probably right about the overhead in using merge or update, and I had thought about efficiency issues when writing that response. I thought it would look more like MochiKit, as machineghost asked,

[mochikit] Re: New INPUT short-hand functions?

2007-12-17 Thread Bob Ippolito
It still wouldn't work because you need the arguments object, not arguments[0], for the call to apply. My personal preference would be to use merge because it wouldn't mutate the input object you give it, but there are potential efficiency concerns with all that extra overhead. The original