dist/cssobj.amd.js
function setCSSProperty (styleObj, prop, val) {
  var value;
  var important = /^(.*)!(important)\s*$/i.exec(val);
  var propCamel = prefixProp(prop);
  var propDash = prefixProp(prop, true);
  if(important) {
    value = important[1];
    important = important[2];
    if(styleObj.setProperty) styleObj.setProperty(propDash, value, important);
    else {
      // for old IE, cssText is writable, and below is valid for contain !important
      // don't use styleObj.setAttribute since it's not set important
      // should do: delete styleObj[propCamel], but not affect result

      // only work on <= IE8: s.style['FONT-SIZE'] = '12px!important'
      styleObj[propDash.toUpperCase()] = val;
      // refresh cssText, the whole rule!
      styleObj.cssText = styleObj.cssText;
    }
  } else {
    styleObj[propCamel] = val;
  }
}
function setCSSProperty (styleObj, prop, val) {
  var value;
  var important = /^(.*)!(important)\s*$/i.exec(val);
  var propCamel = prefixProp(prop);
  var propDash = prefixProp(prop, true);
  if(important) {
    value = important[1];
    important = important[2];
    if(styleObj.setProperty) styleObj.setProperty(propDash, value, important);
    else {
      // for old IE, cssText is writable, and below is valid for contain !important
      // don't use styleObj.setAttribute since it's not set important
      // should do: delete styleObj[propCamel], but not affect result

      // only work on <= IE8: s.style['FONT-SIZE'] = '12px!important'
      styleObj[propDash.toUpperCase()] = val;
      // refresh cssText, the whole rule!
      styleObj.cssText = styleObj.cssText;
    }
  } else {
    styleObj[propCamel] = val;
  }
}
function setCSSProperty ( styleObj , prop , val ) { var value ; var important = / ^(.*)!(important)\s*$ / i . exec ( val ) ; var propCamel = prefixProp ( prop ) ; var propDash = prefixProp ( prop , true ) ; if ( important ) { value = important [ 1 ] ; important = important [ 2 ] ; if ( styleObj . setProperty ) styleObj . setProperty ( propDash , value , important ) ; else { // for old IE, cssText is writable, and below is valid for contain !important // don't use styleObj.setAttribute since it's not set important // should do: delete styleObj[propCamel], but not affect result // only work on <= IE8: s.style['FONT-SIZE'] = '12px!important' styleObj [ propDash . toUpperCase ( ) ] = val ; // refresh cssText, the whole rule! styleObj . cssText = styleObj . cssText ; } } else { styleObj [ propCamel ] = val ; } }
Get value and important flag from value str
@param {CSSStyleRule} rule css style rule object
@param {string} prop prop to set
@param {string} val value string
Get value and important flag from value str