title: jQuery: Setting 'style' attribute of element with object
body: <p>I saw this in our codebase the other day:</p>
  
  <pre><code>            link.attr('style', map({
                  color: '#9a4d9e',
                  cursor: 'default'
              }));
  </code></pre>
  
  <p><code>map</code> is defined as:</p>
  
  <pre><code>function map(map) {
      var cssValue = [];
  
      for (var o in map) {
          cssValue.push(o + ':' + map[o] + ';')
      }
  
      return cssValue.join(';');
  }
  </code></pre>
  
  <p>Is <code>map</code> necessarily? Is there a shorter way to do this?</p>
  
  <p>It's important to note that the "style" attribute overrides any styles set by a class added/defined in the "class" attribute.</p>