Hello, seekers of Perl Wisdom,
I have been using the excellent HTML-Tree distribution by Sean M. Burke for a few days now. Today I ran into problems when trying to create an element with an attribute without a value assigned to it, such as:
<img src="blah.png" ismap>
There seems to be no way to create such a node with new_from_lol(), because
['img', {'ismap' => undef}, ]
deletes the attribute and
['img', {'ismap' => ""}, ]
creates a node such as <img ismap="">.
I then created a file containing
<img ismap> and created a tree from the file with HTML::TreeBuilder. It turns out that
as_HTML() dumps the node as
<img ismap>, but
$node->attr('ismap')
returns
"ismap"! Does anyone know if this is intentional? I.e., is one to check these attributes against values consisting of their own name to look up such HTML elements in a parse tree?
Now comes the weird part: I created a file with the element
<img IsMap> (notice the capitalization).
as_HTML() dumps that one as
<img ismap="IsMap">. That can't be right! Looks like a bug, unless I'm really doing something wrong.
I've already contacted the author, but I figured someone here might know something ...?
Any ideas?
Thanks,
John