Skip to content

Instantly share code, notes, and snippets.

@kamipo
Created November 17, 2008 02:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kamipo/25635 to your computer and use it in GitHub Desktop.
Save kamipo/25635 to your computer and use it in GitHub Desktop.
{
use CSS::Tiny::Style ();
no warnings 'redefine';
sub CSS::Tiny::Style::_sel_arr {
local $_ = shift;
my @d;
while ($_) {
my ($tag, $op);
# s/([a-zA-Z0-9.\#\*]+)\s*$//; $tag = $1;
s/([\w.\#\*\-\:]+)\s*$//; $tag = $1;
$op = $1 if (s/(\s*[+>]*\s*)$//);
push @d, $tag if $tag;
for ($op) {
/\+/ && do { push @d, 'left'; last; };
/\>/ && do { push @d, 'parent'; last; };
/^\s+$/ && do { push @d, 'lineage'; last; };
}
}
return @d;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment