Email HTML and <col> element

At the end of this message is a simple HTML file demonstrating the problem.

If the resulting HTML file for a body or attachment in a “Send an email” step contains a <colgroup> with one or more unclosed <col> tags, the task fails with the following error:

Error encountered in step with name [Email HTML export]: Error: Task ‘Email export’ Body template. Template could not be loaded due to exception: The ‘col’ start tag on line 12 position 8 does not match the end tag of ‘colgroup’. Line 13, position 7.

If I rewrite my template to include closing </col> tags, the “Send an email” step works.

The <col> element is a void element, per MDN, and so putting </col> tags into the output fails strict HTML validation, such as that provided by W3C..

<!DOCTYPE html>
<html lang="en-US">
<head>
  <meta charset="utf-8">
  <title>Col Bug</title>
</head>
<body>
  <table>
    <colgroup>
      <col style="width: 4em">
      <col style="width: 20em">
      <col style="width: auto">
    </colgroup>
    <thead>
      <tr>
        <th>ID</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr id="CeNt2k5GXs4r2ruY_etuJ8">
        <td>E1</td>
        <td>Customer</td>
        <td>
        The customer.</td>
      </tr>
      <tr id="hCGqy7QnJb4SMxph1jUOU9">
        <td>E2</td>
        <td>Clerk</td>
        <td>
        The clerk interacting with the customer.</td>
      </tr>
    </tbody>
  </table>
</body>
</html>

Maybe <col .../>, with the slash at the end?

1 Like

That’s still not valid HTML. Per the MDN page I linked to:

Self-closing tags (<tag />) do not exist in HTML.

1 Like

Humor me, give it a try.

1 Like

Taking my sample file as the body template (so its output is itself), I get the following.

Without any closing </col> or <col ... />: Error as above.

With self-closing <col ... />: Error as above but for the <meta> tag in <head> instead. Plus, the HTML validator shows a warning:

Info : Trailing slash on void elements has no effect and interacts badly with unquoted attribute values.

With closing </col> (which is what I’m doing to work around the bug): Same as with the self-closing tag, but the HTML validator shows an error:

Error : Stray end tag col.

What makes things even more interesting is that, in my production application, I add the closing </col> and it doesn’t complain about the <meta> tag. I can’t reproduce it in this smaller sample.

For the time being, I’m going to go with self-closing on all void elements, but please fix this.