pacerier — 2010-08-22T11:24:51-04:00 — #1
after i've built an element, can i convert that element to html?
the current method i'm thinking is to append this element to a new <Div> and call the Div's innerHTML but it feels rather dirty. is there a better solution?
raffles — 2010-08-22T13:04:57-04:00 — #2
It's not necessarily dirty. You don't have to append the DIV to anything. You can also use a document fragment:
var frag = document.createDocumentFragment();
var html = frag.innerHTML;
delete frag; // if you're concerned about leaving things in memory
pacerier — 2010-08-23T15:16:04-04:00 — #3
heys thanks for the reply. anyways i was wondering do we actually need to explicitly do the delete. is it fine not to include that statement?