Interesting - that's a good point, though (causing the reflow to constantly occur). Would you be willing to file a bug here? http://dev.jquery.com/newticket
--John On Sat, Jan 31, 2009 at 8:38 AM, Boris Ceranic <[email protected]> wrote: > Hi all, > while working on a project, I have a following situation. There is a page > that has about 1000 images on it. Divs which hold images have few classes > that I use as filter for showing/hiding only images that belong to specific > category. > Following piece of code does the actual show/hide job (by specified > criteria): > function show_elems(filt) > { > var all = $('.game-list .games > ul > li').hide(); > if (filt['soft'] != '') all = all.filter('.'+filt['soft']); > if (filt['cat'] != '') all = all.filter('.'+filt['cat']); > all.show(); > } > All this lengthy introduction is because of the fact that this code (and > whole page) works very well (almost to say perfectly) in all but > webkit-based browsers (namely, safari and chrome). After some lengthy > discussions on webkit irc support channel, discovering a bug in webkit, etc, > one of developers found a way to optimize .hide() method so that it doesn't > trigger that specific bug. After I made proposed change in jquery.js, the > problem has disappeared, while functionality was preserved. > Comment #4 From Mark Rowe (bdash) 2009-01-31 03:54 PDT > > I suspect that a trivial change to jQuery could be made to avoid tickling > this > performance cliff. If the "hide" method were changed to use two separate > loops > it would avoid modifying the style info between each query of the "display" > property and would therefore avoid the need to re-layout so many times. > Something like the following: > > hide: function(speed,callback){ > if ( speed ) { > return this.animate( genFx("hide", 3), speed, callback); > } else { > for ( var i = 0, l = this.length; i < l; i++ ){ > var old = jQuery.data(this[i], "olddisplay"); > if ( !old && old !== "none" ) > jQuery.data(this[i], "olddisplay", > jQuery.css(this[i], "display")); > } > > for ( var i = 0, l = this.length; i < l; i++ ) > this[i].style.display = "none"; > } > }, > > > This is not to say that jQuery is to blame; quite opposite: they are glad > that it helped the bug to uncover itself; this is at the same time both > performance optimization and a workaround for problem that's going to be > fixed sometime soon. > > Regards, > > Boris > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" 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/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---
