comment
# Move all the scripts, styles and links to the head area
# TODO this probably doesn't work if the stuff is in a component
# inside a component.
$processed_component->find('link:not(head link)')->each(sub {
$dom->append_link_uniquely($_);
$_->remove;
});
$processed_component->find('style:not(head style)')->each(sub {
my $content = $_->content || '';
$dom->append_style_uniquely($_);
$_->remove;
});
$processed_component->find('script:not(head script)')->each(sub {
my ($e, $num) = @_;
my $content = $dom->content || '';
warn "moving $e to $dom";
$dom->append_script_uniquely($e);
$_->remove;
});
NAME
Template::Lace::Renderer
SYNOPSIS
TBD
DESCRIPTION
Renderer for the model. Not really end user aimed. See Template::Lace for main overview.
METHODS
This class defines the following public methods
call
Allows you to have the renderer 'call' a method into the model, with the current DOM. Takes either a coderef or a string (that must be the name of a method in the model. Example:
$renderer->call(sub {
my ($model, $dom) = @_;
$model->add_debug($dom);
}, @args);
$renderer->call('add_debug', @args);
Are both the same as
$renderer
->model
->add_debug($renderer->dom, @args);
You might find this is a useful shortcut (or not).
call_at
Basically similar to "call" except allows you to specify a CSS match to set the DOM.
$renderer->call_at('#debug','add_debug', @args);
Is basically a shortcut for:
my $dom = $renderer->dom->at('#debug);
$renderer->model->add_debug($dom, @args);
SEE ALSO
AUTHOR
Please See Template::Lace for authorship and contributor information.
COPYRIGHT & LICENSE
Please see Template::Lace for copyright and license information.