File: preinsert.t

package info (click to toggle)
libhtml-treebuilder-libxml-perl 0.28-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 264 kB
  • sloc: perl: 533; makefile: 2; sh: 1
file content (19 lines) | stat: -rw-r--r-- 512 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use strict;
use warnings;
use Test::More;
use Test::Exception;
use HTML::TreeBuilder::LibXML;
use HTML::TreeBuilder::LibXML::Node;
use Data::Dumper;


my $tree = HTML::TreeBuilder::LibXML->new_from_content('<div class="foo">foo</div><span>bar</span>');
my @nodes = $tree->guts;

my ($p) = HTML::TreeBuilder::LibXML->new_from_content('<div><p/></div>')->findnodes('//p');

$p->preinsert(@nodes);
is $p->parent->as_HTML, '<div><div class="foo">foo</div><span>bar</span><p></p></div>', 'preinsert';


done_testing;