I am implementing CodeMirror (http://marijn.haverbeke.nl/codemirror/) on a page where document.domain needs to be declared (because of other IFRAMES on the page).
Co
Got it to work, finally. A hack inspired by TinyMCE code.
var u = 'javascript:(function(){document.open();document.domain="' + document.domain + '";var ed = window.parent.CodeMirror_boilerplate;document.write(ed);document.close();})()';
frame.src = u;
It sets the document.domain in SRC and not by DOM.