Closed GuntherRademacher closed 1 year ago
Just fine. I have merely fixed a few small formatting issues. If you use Eclipse, you can install Checkstyle. The resulting warnings will be displayed in the ·Problems· view of the IDE.
Thanks! I will have a look at Checkstyle.
More unwanted whitespace was found using (X)HTML serialization with
indent=yes
. An example of this isAs is, browsers show it as
But when serialized with
method=html
andindent=yes
, it becomesand browsers show it as
The difference in this case is caused by the indentation whitespace that was added between the closing tags for
b
anda
. According to the serialization spec, that whitespace should not be there, becausea
andb
are "inline" elements - seeThis fix keeps track of the most recent tag, in case it is a closing tag. When adding indentation, that and a following opening tag are checked for being inline elements. In case either of them is, the whitespace is suppressed.
As the spec suggests, the list of inline elements is taken from HTML and XHTML DTDs, and from HTML 5. Different lists could be used for HTML and XHTML, and in contrast to the implementation here,
ins
anddel
could additionally be checked for child elements before suppressing the whitespace. However for the sake of simplicity, I thought it is acceptable to use a single list and omit those extra checks. This would in the worst case add slightly less indentation whitespace than could be.