Since I am doing this for my work right now, I have done a small amount of research. From what I found out, there are two ways to do this:
Document.designMode
Using document.designMode in JavaScript, which allows you to edit the entire HTML document. Since the entire HTML document is editable, presumably an iframe is required to encapsulate editing so that the user cannot edit any part of the page that you do not want to edit.
From what I can tell, the demo you linked and TinyMCE uses this method.
contenteditable
The contenteditable HTML attribute is similar, but does not require the use of an iframe . You add the attribute to the tag, and all the HTML inside it becomes editable with a blinking cursor.
Here is a demonstration of it: http://html5demos.com/contenteditable
Notes
source share