Editor: don't mess up markup when injecting it to the page

Turns out a jQuery bug [1] corrupts HTML attribute values that look like
self-closing tags and in some cases this was altering the value of the
hidden input fields.

Besides, too much jQuery was being used to incorporate the final markup to
the page, and this commit simplifies the approach.

Fixes #278.

[1] http://bugs.jquery.com/ticket/13821