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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.