Hi,

Google for event delegation, and code something like this:

$$('table.MTABLE').each(function(table) {
  table.observe('mouseover', function(event) {
    var element = event.findElement('tr');
    if (!element) return;
    element.up('tr').down('th span').addClassName('valVEH'); //not
sure about this withot seeing the HTML
    event.stop();
  });

    table.observe('mouseout', function(event) {
    var element = event.findElement('tr');
    if (!element) return;
    element.up('tr').down('th span').removeClassName('valVEH'); //not
sure about this withot seeing the HTML
    event.stop();
  });
});

Also, as a sidenode, perf is greatly improved by specifying the
tagName of the element you're selecting whenever possible.

So $$('div.bar') is a lot faster than $$('.bar');

Best,

Tobie

Richard Quadling wrote:
> On 23/01/2008, Justin Perkins <[EMAIL PROTECTED]> wrote:
> >
> > I have noticed huge performance problems in IE when doing what should
> > be a simple operation, like: $$('body')
> >
> > It's instantaneous in Firefox, and dog-slow in IE.
> >
> > -justin
>
> I agree.
>
> I am using ...
>
> if (!Prototype.Browser.IE) {
>       $$('.MTABLE tbody tr').invoke('observe', 'mouseover', function(e) {
>               e.element().up('tr').down('th span').addClassName('valVEH');
>       }).invoke('observe', 'mouseout', function(e) {
>               e.element().up('tr').down('th span').removeClassName('valVEH');
>       });
> }
>
> to add a highlight to a span in a TH when the mouse moves over
> anything in that row.
>
> Works as expected and more or less instantly in FF. In IE it takes 2
> seconds (more or less).
>
>
> How do I generate timings?
>
>
> --
> -----
> Richard Quadling
> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> "Standing on the shoulders of some very clever giants!"
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to