Checking your first example i think something like that would fit:
$("<div></div>")
.each(function () {
var that = this;
$.each(hash, function () {
$(that).append(this.ui.render());
}):
});
.appendTo(container);
Also you need to close the div if you are creating it with jquery
2009/2/9 weepy <[email protected]>
>
> It's as simple as :
>
> a =$("<div>")
> a.css({backgroundImage: "url('test.png')"}) // note the 's
>
> c =$("<div>")
>
> c.append(a)
>
> c.html() => "<div style="background-image: url(test.png);"></
> div>" // missing 's
>
> Would .each cause a page reflow ?
>
>
>
>
>
>
> On 9 Feb, 18:36, Leonardo Rossetti <[email protected]> wrote:
> > Do you have a test page? I think using .each in the html element and in
> the
> > object interation could be one solution.
> >
> > 2009/2/9 weepy <[email protected]>
> >
> >
> >
> >
> >
> > > I'm dynamically inserted a large number of elements into a page.
> >
> > > I want it to be nice and speedy, so I wanted to insert them all at
> > > once to avoid multiple reflows. The only way I could figure this out
> > > was :
> >
> > > var outer = $("<div>")
> > > for(var i in hash) {
> > > outer.append( hash[i].ui.render() )
> > > }
> > > $(container).append( outer.html() )
> >
> > > This works - though perhaps a little cumbersome. However I found that
> > > the background image that I was setting on the 'render' call was
> > > getting munged. Essentially the append call removes the single quotes
> > > around the the url
> >
> > > i.e. background: url('xxxx') => background: url(xxx)
> >
> > > Now this is fine until we try to append this back in - in which case
> > > it doesn't work.
> >
> > > I was able to reinsert the quotes with the following regex - and if I
> > > do this it works ok.
> >
> > > var w = h.replace(/url\(([a-zA-Z0-9\/\. ]*)\)/g, function(a,b)
> > > { return "url('" + b + "')" } )
> >
> > > Should jQuery reinsert the quotes in the html upon calling .html ? I'm
> > > not sure if it's a bug or what.
> >
> > --
> > Leonardo Rosseti, Web Developer / Desenvolvedor Web
> > Profile / Perfil:http://www.linkedin.com/in/leoros
> >
>
--
Leonardo Rosseti, Web Developer / Desenvolvedor Web
Profile / Perfil: http://www.linkedin.com/in/leoros
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---