// Laconic simplifies the generation of DOM content. (function(context) { // properly-cased attribute names for IE setAttribute support var attributeMap = { 'acceptcharset' : 'acceptCharset', 'accesskey' : 'accessKey', 'allowtransparency' : 'allowTransparency', 'bgcolor' : 'bgColor', 'cellpadding' : 'cellPadding', 'cellspacing' : 'cellSpacing', 'class' : 'className', 'classname' : 'className', 'colspan' : 'colSpan', 'csstext' : 'style', 'defaultchecked' : 'defaultChecked', 'defaultselected' : 'defaultSelected', 'defaultvalue' : 'defaultValue', 'for' : 'htmlFor', 'frameborder' : 'frameBorder', 'hspace' : 'hSpace', 'htmlfor' : 'htmlFor', 'longdesc' : 'longDesc', 'maxlength' : 'maxLength', 'marginwidth' : 'marginWidth', 'marginheight' : 'marginHeight', 'noresize' : 'noResize', 'noshade' : 'noShade', 'readonly' : 'readOnly', 'rowspan' : 'rowSpan', 'tabindex' : 'tabIndex', 'valign' : 'vAlign', 'vspace' : 'vSpace' }; // The laconic function serves as a generic method for generating // DOM content, and also as a placeholder for helper functions. // // The first parameter MUST be a string specifying the element's // tag name. // // An optional object of element attributs may follow directly // after the tag name. // // Additional arguments will be considered children of the new // element and may consist of elements, strings, or numbers. // // for example: // laconic('div', {'class' : 'foo'}, 'bar'); function laconic() { // create a new element of the requested type var el = document.createElement(arguments[0]); // walk through the rest of the arguments for(var i=1; i