[Dojo-interest] Editor2 Bug and Workaround
Wolterink Webdesign Postmaster
postmaster at wolterinkwebdesign.com
Tue Aug 15 05:07:10 MDT 2006
The file /src/widget/templates/richtextframe.html
contains the following code:
<script type="text/javascript">
function init(){
document.designMode = 'On';
parentPageDomain = document.location.href.split('#')[1];
if (parentPageDomain) {
document.domain = parentPageDomain;
}
}
window.onload = init;
</script>
When you try to load a Editor2 component that is invisible (for
example behand a Tab), you will get the following exception in firefox
1.5:
uncaught exception: [Exception... "Component returned failure code:
0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIDOMNSHTMLDocument.designMode]"
nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame ::
http://localhost:8084/XDataSystem/standard/js/dojo/src/widget/templates/richtextframe.html#
:: init :: line 9" data: no]
This is due to a bug in Firefox. Setting
designMode='On' on an invisible document will
throw this exception.
The workaround is as follows:
<script type="text/javascript">
function init(){
//document.designMode = 'On';
parentPageDomain = document.location.href.split('#')[1];
if (parentPageDomain) {
document.domain = parentPageDomain;
}
}
window.onload = init;
window.onfocus = function() {
document.designMode = 'On';
}
</script>
Now designMode will be toggled on when the
document gets focus... This is wat you want, and
will not throw the error. ( a document cannot get focus
when it is invisible).
I don't know how to add this to the sourcebase of dojo....
Can anybody add it?
Thanks in advance.
--
Wolterink Webdesign
More information about the Dojo-interest
mailing list