src/utils/styleParser.js
function styleParse (str, obj) {
  var chunks;
  var i;
  var item;
  var pos;
  var key;
  var val;

  obj = obj || {};

  chunks = getKeyValueChunks(str);
  for (i = 0; i < chunks.length; i++) {
    item = chunks[i];
    if (!item) { continue; }
    // Split with `.indexOf` rather than `.split` because the value may also contain colons.
    pos = item.indexOf(':');
    key = item.substr(0, pos).trim();
    val = item.substr(pos + 1).trim();
    obj[key] = val;
  }
  return obj;
}
function styleParse (str, obj) {
  var chunks;
  var i;
  var item;
  var pos;
  var key;
  var val;

  obj = obj || {};

  chunks = getKeyValueChunks(str);
  for (i = 0; i < chunks.length; i++) {
    item = chunks[i];
    if (!item) { continue; }
    // Split with `.indexOf` rather than `.split` because the value may also contain colons.
    pos = item.indexOf(':');
    key = item.substr(0, pos).trim();
    val = item.substr(pos + 1).trim();
    obj[key] = val;
  }
  return obj;
}
function styleParse ( str , obj ) { var chunks ; var i ; var item ; var pos ; var key ; var val ; obj = obj || { } ; chunks = getKeyValueChunks ( str ) ; for ( i = 0 ; i < chunks . length ; i ++ ) { item = chunks [ i ] ; if ( ! item ) { continue ; } // Split with `.indexOf` rather than `.split` because the value may also contain colons. pos = item . indexOf ( ':' ) ; key = item . substr ( 0 , pos ) . trim ( ) ; val = item . substr ( pos + 1 ) . trim ( ) ; obj [ key ] = val ; } return obj ; }
Convert a style attribute string to an object.

@param {object} str - Attribute string.
@param {object} obj - Object to reuse as a base, else a new one will be allocated.
Convert a style attribute string to an object .