[jQuery] Re: Major Problem With Dom Traversal

2007-11-09 Thread Flesler

Yes, but if he uses .eq(0), he will be forced to use append, and if
the rule addition is done many times, he would be bloating the css
with duplicates. Dunno if that's such a problem, maybe .eq(0) works
well. Though.. doesn't IE give more priority to the first rule and
others to the last ? that could cause different behaviors on each
browser...
In conclusion, fambizzari, do as you wish, you should try all this
options and see what works better...

Ariel Flesler


On 8 nov, 18:50, Guy Fraser [EMAIL PROTECTED] wrote:
 Could you not just use .eq(0) to get the first style node and append to
 that?



 Flesler wrote:
  And that worked? if you have more than one style node, you would be
  appending that to more than one, causing some overhead.
  You could try this:

  var $style = $('#my_style');

  if( $style.length == 0 )
  $style = $('style').attr('type','text/
  css').attr('id','my_style').appendTo('head');

   $style.text(.siteWidth{width:  + modifiedW +});//add 'px' if
  modifiedW lacks it- Ocultar texto de la cita -

 - Mostrar texto de la cita -



[jQuery] Re: Major Problem With Dom Traversal

2007-11-08 Thread Guy Fraser

Could you not just use .eq(0) to get the first style node and append to 
that?

Flesler wrote:
 And that worked? if you have more than one style node, you would be
 appending that to more than one, causing some overhead.
 You could try this:

 var $style = $('#my_style');

 if( $style.length == 0 )
 $style = $('style').attr('type','text/
 css').attr('id','my_style').appendTo('head');

  $style.text(.siteWidth{width:  + modifiedW +});//add 'px' if
 modifiedW lacks it
   



[jQuery] Re: Major Problem With Dom Traversal

2007-11-08 Thread Flesler

And that worked? if you have more than one style node, you would be
appending that to more than one, causing some overhead.
You could try this:

var $style = $('#my_style');

if( $style.length == 0 )
$style = $('style').attr('type','text/
css').attr('id','my_style').appendTo('head');

 $style.text(.siteWidth{width:  + modifiedW +});//add 'px' if
modifiedW lacks it

Ariel Flesler

On 8 nov, 02:43, fambizzari [EMAIL PROTECTED] wrote:
 Flesler, that's what we ended up doing...

 $(head style).append(.siteWidth{width:  + modifiedW +});

 But it still took the same amount of time for the page to update.

 I wonder why?



[jQuery] Re: Major Problem With Dom Traversal

2007-11-07 Thread Flesler

you should use css, if you have only two or 3 states of width, you
could use CSS classes.
Else you can have a style tag and append rules to it.


On Nov 6, 8:20 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Working on a page with a table of about 10,000 rows and 30 div's, the
 following takes about 5 seconds

 $(div.siteWidth).css(width, modifiedW);

 What am I doing wrong? How can the table be bypassed?



[jQuery] Re: Major Problem With Dom Traversal

2007-11-07 Thread fambizzari

Flesler, that's what we ended up doing...

$(head style).append(.siteWidth{width:  + modifiedW +});

But it still took the same amount of time for the page to update.

I wonder why?



[jQuery] Re: Major Problem With Dom Traversal

2007-11-06 Thread Suni

It is very likely that the selection can be optimized a lot, but we'd
need to see the structure of the HTML better to give advice...