my $body = HTML::Zoom
->from_html(<<BODY);
<div id="stuff">
- <p>Stuff</p>
+ <p>Well Now</p>
+ <p id="p2">Is the Time</p>
</div>
BODY
my $output = $root
-->select('title')
-->replace_content('Hello World')
-->select('body')
-->replace_content($body)
-->to_html;
+ ->select('title')
+ ->replace_content('Hello World')
+ ->select('body')
+ ->replace_content($body)
+ ->then
+ ->set_attribute(class=>'main')
+ ->then
+ ->add_to_attribute(class=>'one-column')
+ ->then
+ ->set_attribute(id=>'top')
+ ->then
+ ->add_to_attribute(id=>'deleteme')
+ ->then
+ ->remove_attribute({name=>'id', value=>'deleteme'})
+ ->select('p')
+ ->set_attribute(class=>'para')
+ ->select('#p2')
+ ->set_attribute(class=>'para2')
+ ->to_html;
my $expect = <<HTML;
<head>
<title>Hello World</title>
</head>
- <body><div id="stuff">
- <p>Stuff</p>
+ <body class="main one-column" id="top"><div id="stuff">
+ <p class="para">Well Now</p>
+ <p id="p2" class="para2">Is the Time</p>
</div>
</body>
</html>