-
Notifications
You must be signed in to change notification settings - Fork 587
Open
Labels
Description
- Mojolicious version: 9.31
- Perl version: v5.36.0
- Operating system: Linux (Ubuntu 22.04)
Steps to reproduce the behavior
#!/usr/bin/env perl
use v5.14.0;
use warnings;
use Test::More;
use Mojo::DOM;
my $dom = Mojo::DOM->new(<<'_EOT_');
<!DOCTYPE html>
<ul> <li>Ax1</li> </ul>
_EOT_
for my $selector (
"ul li",
"ul\tli",
"ul \tli",
"ul\t li",
) {
is_deeply
$dom->find($selector)->map(sub { $_->to_string })->to_array,
['<li>Ax1</li>'],
'selector "' . $selector =~ s/\t/\\t/r . '"';
}
done_testing;
Expected behavior
Test passes.
https://www.w3.org/TR/selectors-3/#descendant-combinators:
A descendant combinator is whitespace that separates two sequences of simple selectors.
Actual behavior
ok 1 - selector "ul li"
not ok 2 - selector "ul\tli"
# Failed test 'selector "ul\tli"'
# at mojo-dom-bug-4.pl line 19.
# Structures begin differing at:
# $got->[0] = Does not exist
# $expected->[0] = '<li>Ax1</li>'
ok 3 - selector "ul \tli"
not ok 4 - selector "ul\t li"
# Failed test 'selector "ul\t li"'
# at mojo-dom-bug-4.pl line 19.
# Structures begin differing at:
# $got->[0] = Does not exist
# $expected->[0] = '<li>Ax1</li>'
1..4
# Looks like you failed 2 tests of 4.