Browse files

Changed 'extend' to 'extends' for readablity

A few other small changes and fixes
  • Loading branch information...
1 parent 3d69390 commit d3d544e9387eaef28dd4a4b6fc0219dfad754a68 @peteboere committed May 10, 2012
Showing with 12 additions and 15 deletions.
  1. +6 −10 lib/Core.php
  2. +3 −3 lib/Rule.php
  3. +3 −2 plugins/hocus-pocus.php
View
16 lib/Core.php
@@ -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
@@ -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
@@ -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
View
6 lib/Rule.php
@@ -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 {
@@ -626,7 +626,7 @@ public function __construct ( $raw_selector, $associated_rule = null ) {
public function __toString () {
- return $this->value;
+ return $this->readableValue;
}
}
View
5 plugins/hocus-pocus.php
@@ -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.