You are here

function csstidy::css_add_property in Advanced CSS/JS Aggregation 6

Adds a property with value to the existing CSS code

@access private @version 1.2

Parameters

string $media:

string $selector:

string $property:

string $new_val:

2 calls to csstidy::css_add_property()
csstidy::merge_css_blocks in advagg_css_compress/csstidy/class.csstidy.inc
Adds CSS to an existing media/selector
csstidy::parse in advagg_css_compress/csstidy/class.csstidy.inc
Parses CSS in $string. The code is saved as array in $this->css

File

advagg_css_compress/csstidy/class.csstidy.inc, line 983

Class

csstidy
CSS Parser class

Code

function css_add_property($media, $selector, $property, $new_val) {
  if ($this
    ->get_cfg('preserve_css') || trim($new_val) == '') {
    return;
  }
  $this->added = true;
  if (isset($this->css[$media][$selector][$property])) {
    if (csstidy::is_important($this->css[$media][$selector][$property]) && csstidy::is_important($new_val) || !csstidy::is_important($this->css[$media][$selector][$property])) {
      $this->css[$media][$selector][$property] = trim($new_val);
    }
  }
  else {
    $this->css[$media][$selector][$property] = trim($new_val);
  }
}