
Burak Arslan schrieb am 30.09.2014 um 10:05:
On 09/25/14 19:59, Stefan Behnel wrote:
It's libxml2 serialising them, though. lxml has no word in this.
OTOH, it might be a good idea to make xf.element() aware of self-closing tags in HTML mode and let it a) write them out without closing tag and b) raise an exception when users attempt to write content into them.
I disagree. If the user explicitly wants to write something inside, say, an input element, (s)he should be free to do so, just like the user is free to write namespaced elements. This may be for good reason -- e.g. for a fancy javascript framework that expects that kind of input.
Granted.
So, what you're saying is that even
with xf.element('meta', ...): pass
should write an opening and a closing tag?
You'd then write
with xf.element('meta', ...): pass
which isn't really worse than
xf.write(etree.Element('meta', ...))
That's another inconsistency, because the latter would still serialise some self-closing elements with closing tags.
Which ones? How come? I'm testing every single one of them here:
https://github.com/lxml/lxml/blob/f8bdb7d48b5cf4403aa6bbbf10f5f8da6a4a510e/s...
Yes, and you put a comment there that said:
""" # FIXME: These don't get serialized as void elements. """
Stefan