[Imps] Omitting optional tags when serializing: unit tests

Thomas Broyer t.broyer at gmail.com
Wed May 30 00:49:20 PDT 2007

Hi all,

For those of you developing HTML serializers, I've added an
HTMLSerializer class to html5lib this weekend. The code to omit
optional tags has a bunch of unit tests with almost 100% code coverage
(see below about start tags with attributes).

Unit tests are in JSON so they can be used in other projects too (as
well as all the other html5lib tests). I'll add documentation about
the exact "format" during the week.

There's only one test for "a start tag must never be omitted if it has
any attributes" using "<html lang=en>foo". It expects the attribute
value not to be quoted.
If your implementation would not omit the <html> start tag in this
case if it had had no attribute ("<html>foo"), change this test or,
better, provide new similar tests for other cases. (Actually, I think
that every test where the start tag can be omitted should have a
corresponding test with an attribute to check that in this case it is
not; I'll add them if I find some time, but I'll accept any patch that
would save me this task ;-).

Tests are here:

Thomas Broyer

More information about the Implementors mailing list