I was wondering about the possibility of having some kind of buffering capability in jQuery, eg:
var $buffer = $.buffer();
$buffer.add( $('body').append(this) ); // any DOM touches get buffered
$.buffer().flush(); // write to DOM
I know you can manage this manually as Paul states in his pre and I havn't thought about the implications too deeply, but a nice abstracted way to do this would be really helpful. I've noticed when using new CSS3 styling like dropshadows, DOM touching get's really expensive.
however this doesn't really follow the methods presented by Paul Irish. to follow the method he presented, you would just directly append that entire document fragement to the body at once.
his presentation talks about the building of the group of frags. you shouldn't append each frag as you build it in a loop, but instead append all of the frags after you've built them in a loop. you've already got the frags built, so all you have to do is append them. ( unless i've mis-understood his slides )
Thanks guys. I get that this can be done with simple arrays and then appending all at once as Paul details in his pre.
I guess the buffer concept doesn't really apply with a DOM (I was thinking along the lines of PHP output buffering). Maybe it's just a workflow issue of cloning or detaching the affected portion of the DOM (the target of the append), making all the changes off-DOM and then reattaching.
But would be cool to have some native buffer function which when turned on, tries to stack up all DOM touching until the buffer is flushed ...
Leave a comment on forget.the.internet's reply
Change topic type
Link this topic
Provide the permalink of a topic that is related to this topic