Skip to content

Commit

Permalink
combinators do not need to be surrounded by whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 27, 2015
1 parent 2dc2492 commit 9654d3b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion Changes
@@ -1,7 +1,9 @@

5.76 2015-01-27
5.76 2015-01-28
- Improved Hypnotoad load balancing by calling srand() after starting a new
worker in Mojo::Server::Prefork.
- Fixed bug in Mojo::DOM::CSS where combinators needed to be surrounded by
whitespace.

5.75 2015-01-26
- Added healthy method to Mojo::Server::Prefork.
Expand Down
10 changes: 5 additions & 5 deletions lib/Mojo/DOM/CSS.pm
Expand Up @@ -16,11 +16,11 @@ my $ATTR_RE = qr/
/x;
my $PSEUDO_CLASS_RE = qr/(?::([\w\-]+)(?:\(((?:\([^)]+\)|[^)])+)\))?)/;
my $TOKEN_RE = qr/
(\s*,\s*)? # Separator
((?:[^[\\:\s,]|$ESCAPE_RE\s?)+)? # Element
($PSEUDO_CLASS_RE*)? # Pseudoclass
((?:$ATTR_RE)*)? # Attributes
(?:\s*([>+~]))? # Combinator
(\s*,\s*)? # Separator
((?:[^[\\:\s,>+~]|$ESCAPE_RE\s?)+)? # Element
($PSEUDO_CLASS_RE*)? # Pseudoclass
((?:$ATTR_RE)*)? # Attributes
(?:\s*([>+~]))? # Combinator
/x;

sub match {
Expand Down
2 changes: 2 additions & 0 deletions t/mojo/dom.t
Expand Up @@ -1171,8 +1171,10 @@ is $dom->at('h1 ~ p ~ p')->text, 'F', 'right text';
is $dom->at('h1 + p ~ p')->text, 'F', 'right text';
is $dom->at('h1 ~ p + p')->text, 'F', 'right text';
is $dom->at('h1 + p + p')->text, 'F', 'right text';
is $dom->at('h1+p+p')->text, 'F', 'right text';
is $dom->at('ul > li ~ li')->text, 'C', 'right text';
is $dom->at('ul li ~ li')->text, 'C', 'right text';
is $dom->at('ul>li~li')->text, 'C', 'right text';
is $dom->at('ul li li'), undef, 'no result';
is $dom->at('ul ~ li ~ li'), undef, 'no result';
is $dom->at('ul + li ~ li'), undef, 'no result';
Expand Down

0 comments on commit 9654d3b

Please sign in to comment.