Skip to content

Instantly share code, notes, and snippets.

@johan
Created October 30, 2012 00:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johan/3977584 to your computer and use it in GitHub Desktop.
Save johan/3977584 to your computer and use it in GitHub Desktop.
A more useful DocumentType.prototype.toString implementation than present-day browsers provide.
# With thanks to Stewart Brodie for the reminder: http://goo.gl/IHa4p
# (See old version of this gist for a more roundabout hack I came up with)
window.DocumentType::toString = -> (new XMLSerializer).serializeToString @
// With thanks to Stewart Brodie for the reminder: http://goo.gl/IHa4p
// (See old version of this gist for a more roundabout hack I came up with)
window.DocumentType.prototype.toString = function() {
return (new XMLSerializer).serializeToString(this);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment