function attachAttr (ele, attr) {
    for (var a in attr) {
        ele.setAttribute(a, attr[a]);
    }
    return ele;
}

/**
 * Attaches DOM attribles to an elements
 * @param {object} ele    A DOM Element in which to add the CSS to.
 * @param {object} attrObj Attributes in which to add to the Element in an object
 * @returns {object} ele  Passes the element with attributes attached.
 *
 * @example
 *  var x = document.createElement('img'),
 * 		attr = {
 * 			'src': 'http://example.com/something.gif',
 *    		'width': '100',
 *    		'height': '200'
 *   	};
 *  // Returns x (<img src="http://example.com/something.gif" width="100" height="200" />)
 */
function attachAttr (ele, attrObj) {
    for (var attr in attrObj) {
        ele.setAttribute(attr, attrObj[attr]);
    }

    return ele;
}

Add JSDoc info for attachAttr