Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 41 lines (37 sloc) 1.023 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
<?php
/**
* Shim for CSS3 'initial' keyword value
* (http://www.w3.org/TR/css3-cascade/#initial0)
*
* @before
* opacity: initial;
* white-space: initial;
* min-height: initial;
*
* @after
* opacity: 1;
* white-space: normal;
* max-height: auto;
*
*/

csscrush_hook::add( 'rule_prealias', 'csscrush__initial' );

function csscrush__initial ( csscrush_rule $rule ) {

static $initialValues = null;
if ( ! $initialValues ) {
if ( ! ( $initialValues = @parse_ini_file( CssCrush::$config->location . '/misc/initial-values.ini' ) ) ) {
trigger_error( __METHOD__ . ": Initial keywords file could not be parsed.\n", E_USER_NOTICE );
return;
}
}

foreach ( $rule as &$declaration ) {
if ( !$declaration->skip && 'initial' === $declaration->value ) {
if ( isset( $initialValues[ $declaration->property ] ) ) {
$declaration->value = $initialValues[ $declaration->property ];
}
else {
// Fallback to 'inherit'
$declaration->value = 'inherit';
}
}
}
}
Something went wrong with that request. Please try again.