$patterns['possibly_negative_quantity'] = "((?:-?{$patterns['quantity']})|(?:inherit|auto))";
$patterns['color'] = "(#?{$patterns['nmchar']}+|(?:rgba?|hsla?)\([ \d.,%-]+\))";
$patterns['url_chars'] = "(?:{$patterns['url_special_chars']}|{$patterns['nonAscii']}|{$patterns['escape']})*";
- $patterns['lookahead_not_open_brace'] = "(?!({$patterns['nmchar']}|\r?\n|\s|#|\:|\.|\,|\+|>|\(|\))*?{)";
+ $patterns['lookahead_not_open_brace'] = "(?!({$patterns['nmchar']}|\r?\n|\s|#|\:|\.|\,|\+|>|\(|\)|\[|\]|=|\*=|~=|\^=|'[^']*'])*?{)";
$patterns['lookahead_not_closing_paren'] = "(?!{$patterns['url_chars']}?{$patterns['valid_after_uri_chars']}\))";
$patterns['lookahead_for_closing_paren'] = "(?={$patterns['url_chars']}?{$patterns['valid_after_uri_chars']}\))";
$patterns['noflip_single'] = "/({$patterns['noflip_annotation']}{$patterns['lookahead_not_open_brace']}[^;}]+;?)/i";
* @dataProvider provideTransformAdvancedCases
*/
public function testTransformAdvanced( $code, $expectedOutput, $options = array() ) {
- $swapLtrRtlInURL = isset( $options['swapLtrRtlInURL'] ) ? $options['swapLtrRtlInURL'] : false;
- $swapLeftRightInURL = isset( $options['swapLeftRightInURL'] ) ? $options['swapLeftRightInURL'] : false;
+ $swapLtrRtlInURL = isset( $options['swapLtrRtlInURL'] ) ?
+ $options['swapLtrRtlInURL'] : false;
+ $swapLeftRightInURL = isset( $options['swapLeftRightInURL'] ) ?
+ $options['swapLeftRightInURL'] : false;
$flipped = CSSJanus::transform( $code, $swapLtrRtlInURL, $swapLeftRightInURL );
'div { float: left; /* @noflip */ text-align: left; }',
'div { float: right; /* @noflip */ text-align: left; }'
),
+ array(
+ // before a *= attribute selector with multiple properties
+ '/* @noflip */ div.foo[bar*=baz] { float:left; clear: left; }'
+ ),
+ array(
+ // before a ^= attribute selector with multiple properties
+ '/* @noflip */ div.foo[bar^=baz] { float:left; clear: left; }'
+ ),
+ array(
+ // before a ~= attribute selector with multiple properties
+ '/* @noflip */ div.foo[bar~=baz] { float:left; clear: left; }'
+ ),
+ array(
+ // before a = attribute selector with multiple properties
+ '/* @noflip */ div.foo[bar=baz] { float:left; clear: left; }'
+ ),
+ array(
+ // before a quoted attribute selector with multiple properties
+ '/* @noflip */ div.foo[bar=\'baz{quux\'] { float:left; clear: left; }'
+ ),
// Guard against css3 stuff
array(