You don't need <code>empty</code> here, just put <code>jQuery.cleanData</code> call before <code>elem.textContent = value</code>.
Wow, a lot of comments in this PR.