Maxim/Sergey, any pointers?
1)For know we are not support execution of java script in visual editor.
    To allow javascript we should switch off design mode, but know it's hard to do, because all selections events
    processing throw nsISelectionController which can be obtained only if we switch mozilla in design mode.

Where is "design mode" turned on and off? So if I understand correctly ... taking the Mozilla renderer out of design mode turns off the propogation of nsISelectionController events?
 

2) possibly JavaScript that inserted into head node doesn't be executed automatically, because browser executes this scripts
when documents are loaded. When we insert it into DOM, document already loaded.

This sounds right, but if I can't execute javascript at all, I guess it doesn't matter? =)



PS. Using of JavaScript in Visual Editor can strongly change the process handling,  because  we can modify dom using js, and using
xpcom, there then  many questins how to map elements from source and visual part  and others.

Very true.. Our problem is that the appcelerator platform uses javascript code to render widgets.. it's sounding more and more like it would be better to try and approach this using Rhino. I'd still like to fiddle with the design mode to see what I can accomplish though, any pointers to source code?