Implementing inline comment previews is trickier than it seems, as trivial as
the involved AJAX is. I took a look at a couple familiar blogs and saw that getting it right is relatively difficult.
Everybody's beloved redhanded (powered by
hobix) can't swallow non-ASCII text:
Typo seems to do the Right Thing, but I found at least one browser broken
enough to mangle the preview (Konqueror 3.4.3, I don't know whether it's
fixed in newer versions):
Problems
Implementing an inline preview pane sounds as easy as it gets, after all all
you have to do is
take the contents from a textarea and escape them appropriately
send them to the server with an XMLHttpRequest and await the response with the formatted version (just some HTML)
update the innerHTML attribute of some hidden DIV you had somewhere in the page and show it
Only three things to do, little room for errors, right? Well, it turns out
there are also at least three potential problems when you're using GET
for the request:
how to escape properly (client-side, Javascript)
returning a correct response (server-side, your-lang-of-choice)