Fix #360 by adding form to DOM before submit()

Firefox only submits forms that have been attached to the DOM.