racke / Template-Flute

Template::Flute - Modern designer-friendly HTML templating Engine
Other
11 stars 12 forks source link

<nav> element placed after </body> element. #91

Open mrmaloof opened 9 years ago

mrmaloof commented 9 years ago

My template contains the <nav> element as used in the navbar example from bootstrap 3. After calling process the <nav> element is placed after the closing </body> tag.

Here is code to illustrate the problem.

#!/usr/bin/perl
use Template::FLute;

my $spec = q{<specification></specification>};

my $html = q{
<nav class="navbar navbar-default">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">Brand HEY!</a>
        </div>

        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li>
            </ul>
        </div>
    </div>
</nav>};

my $flute = Template::Flute->new( specification => $spec, template => $html );
my $out = $flute->process;
print qq{Error\n} unless $out =~ /<body><nav/;
exit;
racke commented 9 years ago

Please add template HTML which reproduces the problem.

melmothx commented 9 years ago

This is related to this HTML::TreeBuilder bug https://rt.cpan.org/Public/Bug/Display.html?id=103204

As a workaround, wrap the <nav> into a <div> and you'll be fine

racke commented 9 years ago

Which HTML specification defines <nav>?

mrmaloof commented 9 years ago

HTML5 http://www.w3.org/WAI/GL/wiki/Using_HTML5_nav_element