1: you might want to look into var fragment = document.createDocumentFragment();
2: yes via css, is much faster!
I think this youtube video will be worth your while.
Good luck
UPDATE: 9 Jan 2013
Just stumbled over this.
In css3 there is a animation feature using steps.
Basically you create a sprite (in canvas) and then use css3 to animate the sprite using a background-property on a element. Pretty cool (and should use the optimized browser's own code to do this, thus not load the users cpu as much as with javascript/canvas).
It's still not creating a animated gif however (but I think even that should be possible, using a library, since gif and pnp are quite alike, and then feed that gif using the data:image/gif
protocol), but the end result still looks the same in the (modern) browser.
HTML:
<div class="hi"></div>
or <img src="transparent.gif" class="hi">
CSS3:
.hi {
width: 50px;
height: 72px;
background-image: url("http://files.simurai.com/misc/sprite.png");
-webkit-animation: play 1s steps(10) infinite;
-moz-animation: play 1s steps(10) infinite;
-ms-animation: play 1s steps(10) infinite;
-o-animation: play 1s steps(10) infinite;
animation: play 1s steps(10) infinite; }
@-webkit-keyframes play { from { background-position: 0px; }
to { background-position: -500px; } }
@-moz-keyframes play { from { background-position: 0px; }
to { background-position: -500px; } }
@-ms-keyframes play { from { background-position: 0px; }
to { background-position: -500px; } }
@-o-keyframes play { from { background-position: 0px; }
to { background-position: -500px; } }
@keyframes play { from { background-position: 0px; }
to { background-position: -500px; } }
Example jsfiddle.