HTML-Zoom

 view release on metacpan or  search on metacpan

t/parse_cdata.t  view on Meta::CPAN

use strictures 1;
use HTML::Zoom;
use Test::More skip_all => "Totally doesn't work yet";

# Test that contant of elements defined as containing intrinsic CDATA are not
# selected as elements

# NB: This tests HTML parsing rules. XHTML is different.

my $template = <<HTML;
<!DOCTYPE html>
<html lang=en-gb>
    <meta charset=utf-8>
    <title>Test</title>
    <style>
        /* <textarea>Unmodified</textarea> */
    </style>
    </head>
    <body>
        <p>Unmodified</p>
        <textarea>Unmodified</textarea>
        <script>
            if (1) {
                document.write('<p>');
            } else {
                document.write('<div>');
            }
            document.write('hello, world');
            if (1) {
                document.write('</p>');
            } else {
                document.write('</div>');
            }
        </script>
HTML

my $expected_p = <<HTML;
<!DOCTYPE html>
<html lang=en-gb>
    <meta charset=utf-8>
    <title>Test</title>
    <style>
        /* <textarea>Unmodified</textarea> */
    </style>
    </head>
    <body>
        <p>Unmodified</p>
        <textarea>Unmodified</textarea>
        <script>
            if (1) {
                document.write('<p>');
            } else {
                document.write('<div>');
            }
            document.write('hello, world');
            if (1) {
                document.write('</p>');
            } else {
                document.write('</div>');
            }
        </script>
HTML

my $expected_t = <<HTML;
<!DOCTYPE html>
<html lang=en-gb>
    <meta charset=utf-8>
    <title>Test</title>



( run in 1.429 second using v1.01-cache-2.11-cpan-119454b85a5 )