This is pretty much a verbatim code move, except that I inlined noop and reset_jquery in the new file. Also, in the last test, I no longer reset the compose state.