I can see in Chrome Develoer Tools that html generated for GWT’s RichTextArea widget is something like this:
<iframe class="GCJ2VDKDEI" style="height: 40px; ">
#document
<html>
<head></head>
<body>entered text</body>
</html>
</iframe>
Could somebody desribe how it works? How is it possible that page embedded in <iframe> is editable for user (looks and behaves like text area)?
I would especially like to know what is that strange #document thing. It’s first time I see something like this and Google gives me no answers :(.
It’s the
Documentnode of the document inside the iframe. AllDocumentnodes have anodeNameproperty of “#document”, which you can see by examiningdocument.nodeName. Chrome’s developer tools are probably handling the iframe by adding an expansion of the iframe’scontentDocumentproperty as a child of the iframe expansion.As to the document being editable, it’s very common for WYSIWYG editors to use an iframe for the editable content. All current browsers allow built-in editing functionality on any element via the
contenteditableattribute, and also at a document level via thedocument.designModeproperty.