Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
use inline modifiers
  • Loading branch information
kraih committed Jan 10, 2015
1 parent 3b30391 commit 03cfe7d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/Mojo/DOM/CSS.pm
Expand Up @@ -284,20 +284,19 @@ sub _value {
$value = quotemeta _unescape($value);

# "~=" (word)
return qr/(?:^|.*\s+)$value(?:\s+.*|$)/i if $op eq '~' && $ci;
return qr/(?:^|.*\s+)$value(?:\s+.*|$)/ if $op eq '~';
return qr/@{[$ci ? '(?i)' : '']}(?:^|.*\s+)$value(?:\s+.*|$)/ if $op eq '~';

# "*=" (contains)
return $ci ? qr/$value/i : qr/$value/ if $op eq '*';
return qr/@{[$ci ? '(?i)' : '']}$value/ if $op eq '*';

# "^=" (begins with)
return $ci ? qr/^$value/i : qr/^$value/ if $op eq '^';
return qr/@{[$ci ? '(?i)' : '']}^$value/ if $op eq '^';

# "$=" (ends with)
return $ci ? qr/$value$/i : qr/$value$/ if $op eq '$';
return qr/@{[$ci ? '(?i)' : '']}$value$/ if $op eq '$';

# Everything else
return $ci ? qr/^$value$/i : qr/^$value$/;
return qr/@{[$ci ? '(?i)' : '']}^$value$/;
}

1;
Expand Down

0 comments on commit 03cfe7d

Please sign in to comment.