docs: function(elem, attr) {
  		if (attr.name && document.attachEvent && !elem.parentNode) {
  			try {
  				// IE fix for not being able to programatically change the name attribute
  				var alt = createElement('<'+elem.tagName+' name="'+attr.name+'">');
  				// fix for Opera 8.5 and Netscape 7.1 creating malformed elements
  				if (elem.tagName === alt.tagName) {
  					elem = alt;
  				}
  			} catch (ex) { }
  		}
  
  		// for each attributeName
  		for (var name in attr) {
  			if (attr.hasOwnProperty(name)) {
  				// attributeValue
  				var value = attr[name],
  					type = getType(value);
  
  				if (name) {
  					if (type === NUL) {
  						value = '';
  						type = VAL;
  					}
  
  					name = ATTR_MAP[name.toLowerCase()] || name;
  
  					if (name === 'style') {
  						if (getType(elem.style.cssText) !== NUL) {
  							elem.style.cssText = value;
  						} else {
  							elem.style = value;
  						}
  
  					} else if (name.substr(0,2) === 'on') {
  						addHandler(elem, name, value);
  
  						// also set duplicated events
  						name = ATTR_DUP[name];
  						if (name) {
  							addHandler(elem, name, value);
  						}
  
  					} else if (!ATTR_DOM[name.toLowerCase()] && (type !== VAL || name.charAt(0) === '$' || getType(elem[name]) !== NUL || getType(elem[ATTR_DUP[name]]) !== NUL)) {
  						// direct setting of existing properties
  						elem[name] = value;
  
  						// also set duplicated properties
  						name = ATTR_DUP[name];
  						if (name) {
  							elem[name] = value;
  						}
  
  					} else if (ATTR_BOOL[name.toLowerCase()]) {
  						if (value) {
  							// boolean attributes
  							elem.setAttribute(name, name);
  
  							// also set duplicated attributes
  							name = ATTR_DUP[name];
  							if (name) {
  								elem.setAttribute(name, name);
  							}
  						}
  
  					} else {
  						// http://www.quirksmode.org/dom/w3c_core.html#attributes
  
  						// custom and 'data-*' attributes
  						elem.setAttribute(name, value);
  
  						// also set duplicated attributes
  						name = ATTR_DUP[name];
  						if (name) {
  							elem.setAttribute(name, value);
  						}
  					}
  				}
  			}
  		}
  		return elem;
  	}