Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
rewrite selector a little differently
  • Loading branch information
kraih committed Jul 11, 2014
1 parent 1622b49 commit 7d86af2
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/Mojo/DOM/CSS.pm
Expand Up @@ -185,11 +185,8 @@ sub _pc {
if $class eq 'checked';

# ":first-*" or ":last-*" (rewrite with equation)
if ($class =~ /^(first|last)-(?:(child)|of-type)$/) {
$class = $1 eq 'first' ? 'nth-' : 'nth-last-';
$class .= defined $2 ? 'child' : 'of-type';
$args = $1 eq 'first' ? 1 : '-n+1';
}
($class, $args) = $1 ? ("nth-$class", 1) : ("nth-last-$class", '-n+1')
if $class =~ s/^(?:(first)|last)-//;

# ":nth-*"
if ($class =~ /^nth-/) {
Expand Down

0 comments on commit 7d86af2

Please sign in to comment.