The problem occurred because the example div was created as a self-closing element in the output, e.g.
<div class="Experiment" />
In HTML 5, a self-closing element is treated the same as an opening tag, so the browser is treating the code equivalent to the following:
Obviously this would cause a problem regarding the nesting of HTML elements. The solution is to find a way to force the templates to never use self-closing elements in the output, resulting in correct operation:
Do you know how this can be accomplished?