Skip to content

Instantly share code, notes, and snippets.

@subtleGradient
Forked from steida/gist:133693
Created June 22, 2009 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save subtleGradient/134113 to your computer and use it in GitHub Desktop.
Save subtleGradient/134113 to your computer and use it in GitHub Desktop.
(function(write, wrapper, slice, fragment){
document.write = function(){
var id = 'document_write' + $time().toString(36);
var html = slice.call(arguments).join('');
write.call(document, '<span id="' + id + '"></span>');
window.addEvent('domready', function(){
$A(wrapper.set('html', html).childNodes).filter(document.write.filter).each(function(node){
fragment.appendChild(node);
});
$(id).parentNode.replaceChild(fragment, $(id));
});
};
document.write.filter = function(el){
return el;
};
})(document.write, new Element('div'), Array.prototype.slice, document.createDocumentFragment());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment