Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2007-06-21 04:43:18

pitonew
New member
Registered: 2006-10-05
Posts: 7

debugging IE 6/7 timing issue with Xinha initialization.

IE 6 and IE 7, seems to have issues with timing.
We have a xinhaInit() function which we have to delay calling about 2500ms, otherwise the focus in the editor doesn't happen.

Our problem is that there are other widget using javascript on the same page.
The IE script debugger seems unsuable to track this kind of issue which seems to relate to improper events handling.
What would be your recommanded way to debug this issue.
I would like to know if there is a way, to test programatically that the ixnha editor is ready to be initialized.
I tried to do that in below code snippet, but that's not sufficiant.

notes :
- we are working with revision 421, but could reproduce same behaviour when replacing with Xinha nightly build of 2007/06/11
- the delay being introduce is the result of trials cycles on that particular client machine (other client machines may be faster, don't necessarily exhibit the problem).


Our code looks like this :
....
<script type="text/javascript" src="/xinha/htmlarea.js"></script>
<script type="text/javascript">
<!--
function xinha_init() {
    var Xplugins =  [ ];
    if(!HTMLArea.loadPlugins(Xplugins, xinha_init)) return;
    var Xeditors_list = ['mytext'];
    var Xconfig  = new HTMLArea.Config();
    Xconfig.toolbar = [ [
      "bold","italic","underline","strikethrough","insertorderedlist",
      "insertunorderedlist","outdent","indent","justifyleft","justifycenter",
      "justifyright","justifyfull","copy","cut","paste","undo","redo"
    ] ];
    var Xeditors = HTMLArea.makeEditors(Xeditors_list, Xconfig, Xplugins);
    HTMLArea.startEditors(Xeditors);
}
if(typeof xinha_init == "function" && typeof HTMLArea.init == "function") {
if (HTMLArea.is_ie) {
      setTimeout("xinha_init()",2500);
} else {
      xinha_init();
}
....

Last edited by pitonew (2007-06-21 05:08:24)

Offline

#2 2007-06-21 07:39:27

ray
Xinha Administrator
From: Germany
Registered: 2005-03-23
Posts: 521
Website

Re: debugging IE 6/7 timing issue with Xinha initialization.

Is there any special reason for that you don't bind the xinha_init function to window.onload ?

Offline

#3 2007-06-21 09:39:41

pitonew
New member
Registered: 2006-10-05
Posts: 7

Re: debugging IE 6/7 timing issue with Xinha initialization.

yes, i don't control directly the whole page, and don't want to overwrite window.onload.

Offline

#4 2007-06-22 16:42:33

ray
Xinha Administrator
From: Germany
Registered: 2005-03-23
Posts: 521
Website

Re: debugging IE 6/7 timing issue with Xinha initialization.

You should consider the method proposed in the NewbieGuide

    Xinha._addEvent(window,'load', xinha_init); // this executes the xinha_init function on page load 
                                                // and does not interfere with window.onload properties set by other scripts

(Of course you have to use   HTMLArea._addEvent() in 421)

Offline

#5 2007-06-26 03:49:12

pitonew
New member
Registered: 2006-10-05
Posts: 7

Re: debugging IE 6/7 timing issue with Xinha initialization.

thanks, that Xinha._addEvent(window,'load',xinha_init); did it.

Offline

Board footer

Powered by FluxBB