I'm having trouble following this one. The `div` element is inserted targeting the `table` element with foster parenting enabled. For the `div` to end up before the `table`, we need [the following](http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#appropriate-place-for-inserting-a-node):

1. > If *last table* has a parent element, then let *adjusted insertion location* be inside *last table*'s parent element, immediately before *last table*, and abort these sub steps.
    
    must be true.
2. > If the *adjusted insertion location* is inside a `template` element, let it instead be inside the `template` element's template contents, after its last child (if any).
    
    must be false.

So from 1 the *last table* has a parent element, the `template`, and the *adjusted insertion location* is inside that parent element.
But from 2 the *adjusted insertion location* is not inside a `template` element. This contradicts 1 above.

By my reading, the error is in 2, and the `div` should instead go after the `table`.