Skip to content

Commit

Permalink
Added a prepend selector (^) as a way to push a selector to the front…
Browse files Browse the repository at this point in the history
… of the tag stack, instead of appending it
  • Loading branch information
shnhrrsn committed Jan 28, 2011
1 parent 5606721 commit 40369db
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lessc.inc.php
Expand Up @@ -48,6 +48,7 @@ class lessc {
public $vPrefix = '@'; // prefix of abstract properties public $vPrefix = '@'; // prefix of abstract properties
public $mPrefix = '$'; // prefix of abstract blocks public $mPrefix = '$'; // prefix of abstract blocks
public $imPrefix = '!'; // special character to add !important public $imPrefix = '!'; // special character to add !important
public $prependSelector = '^'; // prefix for selectors to prepended
public $selfSelector = '&'; public $selfSelector = '&';


static protected $precedence = array( static protected $precedence = array(
Expand Down Expand Up @@ -839,9 +840,13 @@ function compileBlock($block, $parentTags = null, $bindEnv = true) {
$tags = array(); $tags = array();
foreach ($parentTags as $outerTag) { foreach ($parentTags as $outerTag) {
foreach ($block['__tags'] as $innerTag) { foreach ($block['__tags'] as $innerTag) {
$tags[] = trim($outerTag. if($innerTag{0} == $this->selfSelector || $innerTag{0} == ':') {
($innerTag{0} == $this->selfSelector || $innerTag{0} == ':' $tags[] = trim($outerTag.ltrim($innerTag, $this->selfSelector));
? ltrim($innerTag, $this->selfSelector) : ' '.$innerTag)); } else if($innerTag{0} == $this->prependSelector) {
$tags[] = trim(ltrim($innerTag, $this->prependSelector).' '.$outerTag);
} else {
$tags[] = trim($outerTag.' '.$innerTag);
}
} }
} }
} else { } else {
Expand Down

0 comments on commit 40369db

Please sign in to comment.