Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mojo::DOM treats "-- >" as end of comment (it shouldn't) #2029

Open
mauke opened this issue Jan 29, 2023 · 1 comment
Open

Mojo::DOM treats "-- >" as end of comment (it shouldn't) #2029

mauke opened this issue Jan 29, 2023 · 1 comment

Comments

@mauke
Copy link
Contributor

mauke commented Jan 29, 2023

  • Mojolicious version: 9.31
  • Perl version: v5.36.0
  • Operating system: Ubuntu 22.04.1 LTS

Steps to reproduce the behavior

#!/usr/bin/env perl
use v5.12.0;
use warnings;
use Test::More;
use Mojo::DOM;

my $dom = Mojo::DOM->new('<!-- a > -- > b <blink>c</blink> -->');

is_deeply
    $dom->find('blink')->map(sub { $_->to_string })->to_array,
    [],
    'no blink element found in comment';

done_testing;

Expected behavior

Test passes.
After seeing two dashes in a comment, we are in the comment end state. The only semantically interesting characters at this point are >, !, -, and EOF. Anything else (including spaces) adds the -- to the comment string and switches back to the normal comment state. The comment only ends with --> at end of input.

Actual behavior

not ok 1 - no blink element found in comment
#   Failed test 'no blink element found in comment'
#   at mojo-dom-bug-7.pl line 10.
#     Structures begin differing at:
#          $got->[0] = '<blink>c</blink>'
#     $expected->[0] = Does not exist
1..1
# Looks like you failed 1 test of 1.
@poti1
Copy link

poti1 commented Jun 24, 2023

So it should no longer support HTML style comment?

<!-- HTML4 -- >
<!-- HTML5 -->

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants