PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

highlighting issues using IE

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • highlighting issues using IE

    Hi, i got some strange issues using highlithing using IE6 and 7 but Firefox doesn't have any problem.

    I integrated the highlighting functions correctly and the javascript gets loaded into the page. When the highlight functionnality is called but not used (ex: The querystring param is not present) the page displays fine. When the querystring param is present and the highlighting process is executed it's a completly different output. My page doesn't get anything highlighted at all, and several CSS classes that where already in the page now fails to render correctly.

    I have tried to debug the JS without success, nothing in the JS seems to crash at all, the replaces are done correctly. The only thing to note is that using IE, in a page that sports 4 possible highlights, it stops at two... why? i don't know.

    Can anyone help me?

  • #2
    It struck me after some consideration that maybe there was something searched and replaced that the browser did not like. I decided to put the several classes that failed in the HEAD tag instead of the BODY tag. It is perfectly valid to do this but i seems that IE may have an error in reassigning the innerHTML of a body element containing CSS classes.

    This is not a bug of the Wrensoft Engine but more of a bug in IE. So if at anytime you get this kind of error, try putting the classes that fail (including the .hightlight class) outside of the BODY tag of your page.

    PS: I have corrected a possible bug in the JS Engine, you should never have two id's with the same name in a page. This can be fixed by declaring a variable to hold a suffix and changing the replace code this way :

    var l = 0;
    re = new RegExp(term[i], "gi");
    var count = 0; // just incase
    var rew = '';
    var UniqueIdSuffix = 0;
    text = ">" + text + "<"; // temporary tag marks
    do
    {
    l=text.length;
    if(UniqueIdSuffix == 0){
    rew = '$1<span class="zoom_highlight" id="zoom_highlight">$2</span>$3';
    }else{
    rew = '$1<span class="zoom_highlight" id="zoom_highlight'+UniqueIdSuffix+'">$2</span>$3';
    }
    text=text.replace(re, rew);
    count++;
    UniqueIdSuffix++;
    }
    //while(re.lastIndex>0 && count<100); lastIndex not set properly under netscape
    while(l!=text.length && count<100);
    text = text.substring(1, text.length-1); // remove temporary tags

    Comment


    • #3
      Note that i did some tests and forgot to change the class name from zoom_highlight to highlight, please don't forget to change this in the REW = '' or the default highlight procedure will fail...

      Comment

      Working...
      X