You are here

public function CSSCompression_Selectors::selectors in Advanced CSS/JS Aggregation 6

Same name and namespace in other branches
  1. 7 advagg_css_compress/css-compressor-3.x/src/lib/Selectors.inc \CSSCompression_Selectors::selectors()

Selector specific optimizations

Parameters

(array) selectors: Array of selectors:

1 call to CSSCompression_Selectors::selectors()
CSSCompression_Selectors::access in advagg_css_compress/css-compressor-3.x/src/lib/Selectors.inc
Access to private methods for testing

File

advagg_css_compress/css-compressor-3.x/src/lib/Selectors.inc, line 59

Class

CSSCompression_Selectors
CSS Compressor [VERSION] [DATE] Corey Hart @ http://www.codenothing.com

Code

public function selectors(&$selectors = array()) {
  foreach ($selectors as &$selector) {

    // Auto ignore sections
    if (strpos($selector, $this->token) === 0) {
      continue;
    }

    // Smart casing and token injection
    $selector = $this
      ->parse($selector);

    // Converting attr to shorthanded selectors
    if ($this->options['attr2selector']) {

      // Use id hash instead of id attr
      $selector = $this
        ->idAttribute($selector);

      // Use class notation instead of class attr
      $selector = $this
        ->classAttribute($selector);
    }

    // Remove everything before final id in a selector
    if ($this->options['strict-id']) {
      $selector = $this
        ->strictid($selector);
    }

    // Get rid of possible repeated selectors
    $selector = $this
      ->repeats($selector);

    // Add space after pseudo selectors (so ie6 doesn't complain)
    if ($this->options['pseudo-space']) {
      $selector = $this
        ->pseudoSpace($selector);
    }
  }
  return $selectors;
}