Skip to content

Commit

Permalink
Changed 'extend' to 'extends' for readablity
Browse files Browse the repository at this point in the history
A few other small changes and fixes
  • Loading branch information
peteboere committed May 10, 2012
1 parent 3d69390 commit d3d544e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
16 changes: 6 additions & 10 deletions lib/Core.php
Expand Up @@ -721,7 +721,7 @@ protected static function compile ( $stream ) {
// Main processing on the rule objects
self::processRules();

csscrush::log( csscrush::$storage->tokens->rules );
// csscrush::log( csscrush::$storage->tokens->rules );
csscrush::log( array_keys( self::$process->selectorRelationships ) );

// Alias any @-rules
Expand Down Expand Up @@ -999,14 +999,10 @@ public static function processRules () {

foreach ( self::$storage->tokens->rules as $rule ) {

if ( ! $rule->isNested ) {

// Associate selectors with the rule
foreach ( $rule->selectorList as $selector ) {

// $readable_selector = $selector->makeReadableValue();
self::$process->selectorRelationships[ $selector->readableValue ] = $rule;
}
// Associate selectors with the rule
foreach ( $rule->selectorList as $selector ) {

self::$process->selectorRelationships[ $selector->readableValue ] = $rule;
}

// Find previous selectors and apply the
Expand Down Expand Up @@ -1171,7 +1167,7 @@ protected static function cb_printRule ( $match ) {
return '';
}

// Build the selector
// Build the selector; uses selector __toString method
$selectors = implode( ",$whitespace", $rule->selectorList );

// Build the block
Expand Down
6 changes: 3 additions & 3 deletions lib/Rule.php
Expand Up @@ -92,9 +92,9 @@ public function __construct ( $selector_string = null, $declarations_string ) {
}
}
}
elseif ( $prop === 'extend' ) {
elseif ( $prop === 'extends' ) {

// Extend is a special case
// Extends is a special case
$this->setExtendSelectors( $value );
}
else {
Expand Down Expand Up @@ -626,7 +626,7 @@ public function __construct ( $raw_selector, $associated_rule = null ) {

public function __toString () {

return $this->value;
return $this->readableValue;
}
}

Expand Down
5 changes: 3 additions & 2 deletions plugins/hocus-pocus.php
Expand Up @@ -16,9 +16,10 @@
csscrush_hook::add( 'rule_preprocess', 'csscrush_hocuspocus' );

function csscrush_hocuspocus ( $rule ) {

$adjustments = array(
'!:hocus([^a-z0-9_-])!' => ':any(:hover,:focus)$1',
'!:pocus([^a-z0-9_-])!' => ':any(:hover,:focus,:active)$1',
'!:hocus([^a-z0-9_-]|$)!' => ':any(:hover,:focus)$1',
'!:pocus([^a-z0-9_-]|$)!' => ':any(:hover,:focus,:active)$1',
);
$rule->selector_raw = preg_replace( array_keys( $adjustments ), array_values( $adjustments ), $rule->selector_raw );
}

0 comments on commit d3d544e

Please sign in to comment.