You are here

public function SassRuleNode::resolveSelectors in Sassy 7

Same name and namespace in other branches
  1. 7.3 phpsass/tree/SassRuleNode.php \SassRuleNode::resolveSelectors()

* Resolves selectors. * Interpolates SassScript in selectors and resolves any parent references or * appends the parent selectors. *

Parameters

SassContext the context in which this node is parsed:

1 call to SassRuleNode::resolveSelectors()
SassRuleNode::parse in phamlp/sass/tree/SassRuleNode.php
* Parse this node and its children into static nodes. *

File

phamlp/sass/tree/SassRuleNode.php, line 202

Class

SassRuleNode
SassRuleNode class. Represents a CSS rule. @package PHamlP @subpackage Sass.tree

Code

public function resolveSelectors($context) {
  $resolvedSelectors = array();
  $this->parentSelectors = $this
    ->getParentSelectors($context);
  foreach ($this->selectors as $key => $selector) {
    $selector = $this
      ->interpolate($selector, $context);

    //$selector = $this->evaluate($this->interpolate($selector, $context), $context)->toString();
    if ($this
      ->hasParentReference($selector)) {
      $resolvedSelectors = array_merge($resolvedSelectors, $this
        ->resolveParentReferences($selector, $context));
    }
    elseif ($this->parentSelectors) {
      foreach ($this->parentSelectors as $parentSelector) {
        $resolvedSelectors[] = "{$parentSelector} {$selector}";
      }

      // foreach
    }
    else {
      $resolvedSelectors[] = $selector;
    }
  }

  // foreach
  sort($resolvedSelectors);
  return $resolvedSelectors;
}