to assemble a stack of elements that can contain outer before
      // checking whether it can contain inner.
      // If we cannot, we punt so that we can retry later after we've fleshed
      // out more of canAppearIn.
      var stack = containmentStack(outer);
      if (!stack) { return null; }
      stack.push(inner);
      return tagStackToHtml(stack, '');
    }

    function checkCanContain(outer, inner, body, canContain) {
      var outerEls = outer == 'body'
          ? [body] : body.getElementsByT