Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

Commit

Permalink
fix #269, missing on NameValue type
Browse files Browse the repository at this point in the history
  • Loading branch information
oyejorge committed Nov 3, 2015
1 parent fc29f0d commit a8dac63
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/Less/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function __construct( $env = null ){
// mbstring.func_overload > 1 bugfix
// The encoding value must be set for each source file,
// therefore, to conserve resources and improve the speed of this design is taken here
if (ini_get('mbstring.func_overload')) {
if (ini_get('mbstring.func_overload')) {
$this->mb_internal_encoding = ini_get('mbstring.internal_encoding');
@ini_set('mbstring.internal_encoding', 'ascii');
}
Expand Down Expand Up @@ -220,7 +220,7 @@ public function getCss(){
@ini_set('precision',$precision);
setlocale(LC_NUMERIC, $locale);

// If you previously defined $this->mb_internal_encoding
// If you previously defined $this->mb_internal_encoding
// is required to return the encoding as it was before
if ($this->mb_internal_encoding != '') {
@ini_set("mbstring.internal_encoding", $this->mb_internal_encoding);
Expand Down
10 changes: 10 additions & 0 deletions lib/Less/Tree/NameValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Less_Tree_NameValue extends Less_Tree{
public $index;
public $currentFileInfo;
public $type = 'NameValue';
public $important = '';

public function __construct($name, $value = null, $index = null, $currentFileInfo = null ){
$this->name = $name;
Expand All @@ -31,11 +32,20 @@ public function genCSS( $output ){
$this->name
. Less_Environment::$_outputMap[': ']
. $this->value
. $this->important
. (((Less_Environment::$lastRule && Less_Parser::$options['compress'])) ? "" : ";")
, $this->currentFileInfo, $this->index);
}

public function compile ($env){
return $this;
}

public function makeImportant(){
$new = new Less_Tree_NameValue($this->name, $this->value, $this->index, $this->currentFileInfo);
$new->important = ' !important';
return $new;
}


}
2 changes: 1 addition & 1 deletion lib/Less/Tree/Ruleset.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ function makeImportant(){

$important_rules = array();
foreach($this->rules as $rule){
if( $rule instanceof Less_Tree_Rule || $rule instanceof Less_Tree_Ruleset ){
if( $rule instanceof Less_Tree_Rule || $rule instanceof Less_Tree_Ruleset || $rule instanceof Less_Tree_NameValue ){
$important_rules[] = $rule->makeImportant();
}else{
$important_rules[] = $rule;
Expand Down
3 changes: 3 additions & 0 deletions test/Fixtures/bug-reports/css/198.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.goog-menuitem-icon {
filter: alpha(opacity=30);
}
2 changes: 1 addition & 1 deletion test/Fixtures/bug-reports/css/210.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

/* color channel functions */
body .color-channels {
--hue: 210;
--saturation: 50%;
Expand Down

0 comments on commit a8dac63

Please sign in to comment.