Пример #1
0
 function outputSelectors(CSSSelectors $sels)
 {
     $out = '';
     $prev = false;
     foreach ($sels->getSelectors() as $s) {
         if ($prev) {
             $out .= ',';
         } else {
             $prev = true;
         }
         $out .= $this->outputSelector($s);
     }
     return $out;
 }
Пример #2
0
 function CSSRuleset()
 {
     try {
         $selectors = new CSSSelectors();
         $sel = $this->CSSSelector();
         if (!$sel) {
             $this->error('Selector expected');
         }
         $selectors->add($sel);
         while ($this->isValNext(DELIM, ',')) {
             $this->whiteSpace();
             $selectors->add($this->CSSSelector());
         }
         $this->expect(LCBR, 'Selector should end here and rule is expected');
     } catch (CSSParseError $e) {
         $this->skipUpTo(LCBR);
         $this->nextToken();
         $this->skipUpTo(RCBR);
         $this->nextToken();
         $this->whiteSpace();
         return false;
     }
     try {
         $declarations = $this->CSSDeclarations(RCBR);
         if (!$this->isEof()) {
             $this->expect(RCBR, 'Block of declarations should end here');
             $this->whiteSpace();
         }
         return new CSSRuleset($selectors, $declarations);
     } catch (CSSParseError $e) {
         $this->skipUpTo(RCBR);
         $this->nextToken();
         $this->whiteSpace();
         return false;
     }
 }