No need to have "two versions" of function arguments. The "setTimeout( ..., 0)" fires directly after (or extremely soon after) the function finishes and it will work for all browsers.
Because you don't need separate functions you can just include the functions in the "each" scope and so have access to the correct "row" ("r"). You have a very compact coding style, which is fine though rather difficult to quickly understand :). I've rewritten things in a more "jQuery-style". I replaced your "constants" with the actual strings as it was easier to follow. You can, of course, put the "constants" back in: rows.each( function() { var r = $(this); var over = function() { if ( r.is('.rws') ) // selected r.removeClass('rws').addClass('rwsh'); else r.addClass('rwh'); }; var out = function() { if ( r.is('.rwsh') ) // selected + highlighted r.removeClass('rwsh').addClass('rws'); else r.removeClass('rwh'); }; r.hover( function() { setTimeout(over, 0) }, function() { setTimeout(out, 0) } ); }); Karl Rudd On 6/7/07, devsteff <[EMAIL PROTECTED]> wrote:
THATS IT! thanks a lot! it was a little bit tricky for me to pass the row object to the trHigh/ trLow functions, because when triggered by a timeout "this" didn't point to the row (the event target) but to the window object :(. so i must implement a browser switch :( my code looks now like: registration: : : if(jQuery.browser.msie){ rows.each(function(){ var r=$(this); r.hover( function(){setTimeout(function(){trHigh(r);},0);}, function(){setTimeout(function(){trLow(r);},0);}); }); }else rows.hover(trHigh,trLow) : : and the handler functions: var trHigh=function(o){ var r=o&&o[0]?o[0]:this;//o can also be the event in FF var c=r.className; if(c.indexOf(CSS_S)>-1){ c=c.replace(RCSS_S,""); c+=" "+CSS_SH; }else c+=" "+CSS_H; r.className=c; }; var trLow= function(o){ var r=o&&o[0]?o[0]:this; var c=r.className; if(c.indexOf(CSS_S)>-1){ c=c.replace(RCSS_SH,""); c+=" "+CSS_S; }else c=c.replace(RCSS_H,""); r.className=c; }; is there a more elegant way to pass the original event target to an function wich is called via setTimeout?? regards, stefan flick On 6 Jun., 01:56, "Karl Rudd" <[EMAIL PROTECTED]> wrote: > Regarding the "document.execCommand("BackgroundImageCache", false, > true)", the first entry in a Google search for "BackgroundImageCache" > turns up this: > > http://misterpixel.blogspot.com/2006/09/forensic-analysis-of-ie6.html > > As to the slowing "tracking", it looks like IE has a bit of a pause > between the change in className and actually rendering the change to > screen. > > I've just optimised a similar piece of code in project and this is > what I've come up with: > > $('table tr').each( function() { > var row = $(this); > row.hover( > function() { > setTimeout( function() { row.addClass('hover'); }, 0 ); > }, > function() { > setTimeout( function() { row.removeClass('hover'); }, 0 ); > } > ); > > }); > > Somehow using the "setTimeout" bypasses, or shortens, the rendering delay. > > Karl Rudd > > On 6/6/07, devsteff <[EMAIL PROTECTED]> wrote: