src/basis/cssom.js
function setStyleProperty(node, property, value){
    var mapping = styleMapping[property];
    var key = mapping ? mapping.key : camelize(property.replace(/^-ms-/, 'ms-'));

    if (!key)
      return;

    if (mapping && mapping.getter)
      value = mapping.getter(value);

    var imp = !!IMPORTANT_REGEXP.test(value);
    var style = node.style;

    if (imp || isPropertyImportant(style, property))
    {
      value = value.replace(IMPORTANT_REGEXP, '');

      if (style.setProperty)
      {
        // W3C scheme

        // if property exists and important, remove it
        if (!imp)
          // Can't use removeProperty() because it wont remove !important rules in Chrome.
          style.setProperty(property, '');

        // set new value for property
        style.setProperty(property, value, (imp ? IMPORTANT : ''));
      }
      else
      {
        // IE8- scheme
        var newValue = key + ': ' + value + (imp ? ' !' + IMPORTANT : '') + ';';
        var rxText = style[key] ? property + '\\s*:\\s*' + style[key] + '(\\s*!' + IMPORTANT + ')?\\s*;?' : '^';

        try {
          style.cssText = style.cssText.replace(new RegExp(rxText, 'i'), newValue);
        } catch(e) {
          /** @cut */ basis.dev.warn('basis.cssom.setStyleProperty: Can\'t set wrong value `' + value + '` for ' + key + ' property');
        }
      }
    }
    else
    {
      if (SET_STYLE_EXCEPTION_BUG)
      {
        // IE6-8 throw exception when assign wrong value to style, but standart
        // says just ignore this assignments
        // try/catch is speedless, therefore wrap this statement only for ie
        // it makes code safe and more compatible
        try {
          node.style[key] = value;
        } catch(e) {
          /** @cut */ basis.dev.warn('basis.cssom.setStyleProperty: Can\'t set wrong value `' + value + '` for ' + key + ' property');
        }
      }
      else
        node.style[key] = value;

      return node.style[key];
    }
  }
function setStyleProperty(node, property, value){
    var mapping = styleMapping[property];
    var key = mapping ? mapping.key : camelize(property.replace(/^-ms-/, 'ms-'));

    if (!key)
      return;

    if (mapping && mapping.getter)
      value = mapping.getter(value);

    var imp = !!IMPORTANT_REGEXP.test(value);
    var style = node.style;

    if (imp || isPropertyImportant(style, property))
    {
      value = value.replace(IMPORTANT_REGEXP, '');

      if (style.setProperty)
      {
        // W3C scheme

        // if property exists and important, remove it
        if (!imp)
          // Can't use removeProperty() because it wont remove !important rules in Chrome.
          style.setProperty(property, '');

        // set new value for property
        style.setProperty(property, value, (imp ? IMPORTANT : ''));
      }
      else
      {
        // IE8- scheme
        var newValue = key + ': ' + value + (imp ? ' !' + IMPORTANT : '') + ';';
        var rxText = style[key] ? property + '\\s*:\\s*' + style[key] + '(\\s*!' + IMPORTANT + ')?\\s*;?' : '^';

        try {
          style.cssText = style.cssText.replace(new RegExp(rxText, 'i'), newValue);
        } catch(e) {
          /** @cut */ basis.dev.warn('basis.cssom.setStyleProperty: Can\'t set wrong value `' + value + '` for ' + key + ' property');
        }
      }
    }
    else
    {
      if (SET_STYLE_EXCEPTION_BUG)
      {
        // IE6-8 throw exception when assign wrong value to style, but standart
        // says just ignore this assignments
        // try/catch is speedless, therefore wrap this statement only for ie
        // it makes code safe and more compatible
        try {
          node.style[key] = value;
        } catch(e) {
          /** @cut */ basis.dev.warn('basis.cssom.setStyleProperty: Can\'t set wrong value `' + value + '` for ' + key + ' property');
        }
      }
      else
        node.style[key] = value;

      return node.style[key];
    }
  }
function setStyleProperty ( node , property , value ) { var mapping = styleMapping [ property ] ; var key = mapping ? mapping . key : camelize ( property . replace ( / ^-ms- / , 'ms-' ) ) ; if ( ! key ) return ; if ( mapping && mapping . getter ) value = mapping . getter ( value ) ; var imp = ! ! IMPORTANT_REGEXP . test ( value ) ; var style = node . style ; if ( imp || isPropertyImportant ( style , property ) ) { value = value . replace ( IMPORTANT_REGEXP , '' ) ; if ( style . setProperty ) { // W3C scheme // if property exists and important, remove it if ( ! imp ) // Can't use removeProperty() because it wont remove !important rules in Chrome. style . setProperty ( property , '' ) ; // set new value for property style . setProperty ( property , value , ( imp ? IMPORTANT : '' ) ) ; } else { // IE8- scheme var newValue = key + ': ' + value + ( imp ? ' !' + IMPORTANT : '' ) + ';' ; var rxText = style [ key ] ? property + '\\s*:\\s*' + style [ key ] + '(\\s*!' + IMPORTANT + ')?\\s*;?' : '^' ; try { style . cssText = style . cssText . replace ( new RegExp ( rxText , 'i' ) , newValue ) ; } catch ( e ) { /** @cut */ basis . dev . warn ( 'basis.cssom.setStyleProperty: Can\'t set wrong value `' + value + '` for ' + key + ' property' ) ; } } } else { if ( SET_STYLE_EXCEPTION_BUG ) { // IE6-8 throw exception when assign wrong value to style, but standart // says just ignore this assignments // try/catch is speedless, therefore wrap this statement only for ie // it makes code safe and more compatible try { node . style [ key ] = value ; } catch ( e ) { /** @cut */ basis . dev . warn ( 'basis.cssom.setStyleProperty: Can\'t set wrong value `' + value + '` for ' + key + ' property' ) ; } } else node . style [ key ] = value ; return node . style [ key ] ; } }
Apply new style property value for node.
@param {Element} node Node which style to be changed.
@param {string} property Name of property.
@param {string} value Value of property.
@return {*} Returns style property value after assignment.
Apply new style property value for node .