Exemple #1
0
 function parseCss()
 {
     $this->css = $this->stripComments($this->css);
     $this->substituteIncludes();
     $this->substituteVars();
     $this->buildUrls();
     $matches = array();
     preg_match_all('/([^{]*)\\s*{([^}]+)(?:\\s+)?}(?:\\s+)?/', $this->css, $matches);
     $this->selectors = array();
     for ($i = 0; $i < count($matches[0]); ++$i) {
         $selector = new CssSelector($matches[0][$i]);
         if (isset($this->selectors[$selector->selector])) {
             $selector->inherit($this->selectors[$selector->selector]);
         }
         $this->selectors[$selector->selector] = $selector;
     }
     foreach ($this->selectors as $selector) {
         if ($selector->hasSuper()) {
             $super = $this->selectors[$selector->super];
             $selector->inherit($super);
         }
     }
 }