diff --git a/src/document/html/parser/table.c b/src/document/html/parser/table.c
index 1570cae2..e6d03645 100644
--- a/src/document/html/parser/table.c
+++ b/src/document/html/parser/table.c
@@ -670,9 +670,11 @@ see:
goto see;
}
+ /* All following tags have T as first letter. */
+ if (toupper(name[0]) != 'T') goto see;
+
/* /TR /TD /TH */
- if (closing_tag && namelen == 2
- && toupper(name[0]) == 'T') {
+ if (closing_tag && namelen == 2) {
unsigned char c = toupper(name[1]);
if (c == 'R' || c == 'D' || c == 'H') {
@@ -688,9 +690,6 @@ see:
}
}
- /* All following tags have T as first letter. */
- if (toupper(t_name[0]) != 'T') goto see;
-
/* TR */
if (t_namelen == 2 && toupper(t_name[1]) == 'R') {
if (c_span) new_columns(table, c_span, c_width, c_al, c_val, 1);