The tab indentation is now fixed in svn trunk [1384].

Regarding the createINPUT and createINPUTFunc functions, I think it
would be better with a more generic solution. When creating SVG DOM
nodes I wrote a createDOMFuncExt function that should work here also.
See http://trac.mochikit.com/wiki/MochiKitDOMExtensions for the source
code.

Using that function, the partial versions would instead look like:

  FORMBUTTON = createDOMFuncExt(null, "input", null, { type: "button" });
  CHECKBOX = createDOMFuncExt(null, "input", null, { type: "checkbox" });

Or if you think form elements should always be provided with a name attribute:

  FORMBUTTON = createDOMFuncExt(null, "input", ["name"], { type: "button" });
  CHECKBOX = createDOMFuncExt(null, "input", ["name"], { type: "checkbox" });

Either way, I'd like to push this to MochiKit 1.5. I'm currently
mostly doing bug fixes in svn trunk so that we can get to a release of
1.4 as soon as possible.

Cheers,

/Per

On Tue, Jun 10, 2008 at 10:37 PM, machineghost <[EMAIL PROTECTED]> wrote:
>
> I mentioned the idea of a createINPUT function awhile ago, but no one
> seemed terribly interested so I've been slacking on submitting it.
> However, I think a lot of createDOM fans could find createINPUT
> similarly useful, and with the recent flurry of submissions I figured
> now was as good of a time as any to submit it.
>
> For those of you who missed my previous posts, the idea behind
> createINPUT (and all of its partial versions) is to do the same thing
> for the different sub-types of INPUT that createDOM did for every
> other element, as these sub-types are practically different elements.
>
> So, with (the various partial forms of) createINPUT, you can do stuff
> like:
>
> var oldWay = INPUT({"type":"hidden"});
> var newWay = HIDDEN();
> // oldWay.outerHTML == newWay.outerHTML
>
> var oldWay2 = INPUT({"type":"text", "name":"someName"});
> var newWay2 = TEXT("someName");
> // oldWay2.outerHTML == newWay2.outerHTML
>
> var oldWay2 = INPUT({"type":"checkbox", "name":"someName",
> "class":"someClass"});
> var newWay2 = CHECKBOX({"name":"someName", "class":"someClass"});
> // oldWay2.outerHTML == newWay2.outerHTML
>
> Since there is already an HTML element called button, I named the
> <INPUT type="button"> function "FORMBUTTON"; the rest of the aliases
> are just their type .toUpperCase().
>
>
> Here's the diff:
> 32a33,34
>>     "createINPUT",
>>     "createINPUTFunc",
> 83a86,95
>>     "FORMBUTTON",
>>     "CHECKBOX",
>>     "FILE",
>>     "HIDDEN",
>>     "IMAGE",
>>     "PASSWORD",
>>     "RADIO",
>>     "RESET",
>>     "TEXT",
>>     "SUBMIT",
> 627a640,658
>>
>>     /** @id MochiKit.DOM.createINPUTFunc */
>>     createINPUT: function (type, otherattrs) {
>>         var m = MochiKit.Base;
>>         if (typeof(otherattrs) == "string" || typeof(otherattrs) == "number")
>>             return MochiKit.DOM.createDOM("input", {"name":otherattrs, 
>> "type":type});
>>         return MochiKit.DOM.createDOM("input", m.update(otherattrs, 
>> {"type":type}));
>>
>>     },
>>
>>     /** @id MochiKit.DOM.createINPUTFunc */
>>     createINPUTFunc: function (/* type, otherattrs */) {
>>         var m = MochiKit.Base;
>>         return m.partial.apply(
>>             this,
>>             m.extend([MochiKit.DOM.createINPUT], arguments)
>>         );
>>
>>     },
> 1254a1286,1306
>>         var createINPUTFunc = this.createINPUTFunc;
>>         /** @id MochiKit.DOM.FORMBUTTON =  */
>>         this.FORMBUTTON = createINPUTFunc("button");
>>         /** @id MochiKit.DOM.CHECKBOX */
>>         this.CHECKBOX = createINPUTFunc("checkbox");
>>         /** @id MochiKit.DOM.FILE */
>>         this.FILE = createINPUTFunc("file");
>>         /** @id MochiKit.DOM.HIDDEN */
>>         this.HIDDEN = createINPUTFunc("hidden");
>>         /** @id MochiKit.DOM.IMAGE */
>>         this.IMAGE = createINPUTFunc("image");
>>         /** @id MochiKit.DOM.PASSWORD */
>>         this.PASSWORD = createINPUTFunc("password");
>>         /** @id MochiKit.DOM.RADIO */
>>         this.RADIO = createINPUTFunc("radio");
>>         /** @id MochiKit.DOM.RESET */
>>         this.RESET = createINPUTFunc("reset");
>>         /** @id MochiKit.DOM.TEXT */
>>         this.TEXT = createINPUTFunc("text");
>>         /** @id MochiKit.DOM.SUBMIT */
>>         this.SUBMIT = createINPUTFunc("submit");
>
>
> Also, while I was working in DOM.js I noticed that the entire file
> uses spaces, EXCEPT for three tabs; the following diff converts these
> tabs to spaces:
> 1181c1212
> <               /** @id MochiKit.DOM.DL */
> ---
>>         /** @id MochiKit.DOM.DL */
> 1183c1214
> <               /** @id MochiKit.DOM.DT */
> ---
>>         /** @id MochiKit.DOM.DT */
> 1185c1216
> <               /** @id MochiKit.DOM.DD */
> ---
>>         /** @id MochiKit.DOM.DD */
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to