')->hasAttributes, 1, 'hasAttributes works');
$span->removeAttribute('Id');
is $span->toHTML, '
Foo',
'removeAttribute works';
is $span->parentNode->id, 'div2',
'parentNode works';
my $div2 = $dom->getElementById('div2');
my @children = $div2->childNodes;
is scalar(@children), 7, 'div2 has 7 children';
is ref($children[0]), '', 'child 1 is text node';
is $div2->firstChild, "\n ", "firstChild works";
is $div2->lastChild, "\n ", "lastChild works";
$dom = pQuery::DOM->fromHTML('
xxxzzz
');
my @elems = pQuery::DOM->fromHTML('
xxxzzz
')->childNodes;
my $comment = $elems[1];
is $comment->nodeType, 8, 'Handle comment nodes';
is $comment->nodeValue, ' yyy ', 'Handle comment node value';
is $comment->hasAttributes, 0, "Comments don't have attributes";
is $comment->nodeName, '#comment', 'Comment has proper nodeName';
is $comment->tagName, '', 'Comment has no tagName';
is $comment->parentNode->tagName, 'DIV', 'Comment has parentNode';
is $dom->toHTML, '
xxxzzz
', 'Comments work in toHTML';
is $comment->innerHTML, undef, 'Comments have no innerHTML';
$dom->innerHTML('I
Like Pie');
is $dom->toHTML, '
I Like Pie
', 'Setting innerHTML works';
my $div = pQuery::DOM->createElement('div');
$div->id('new-div');
$div->className('classy');
$comment = pQuery::DOM->createComment('I am remarkable');
$div->appendChild('Foo');
$div->appendChild($comment);
is $div->toHTML, '
Foo
',
'createElement, createComment and appendChild work';