Skip to content

Instantly share code, notes, and snippets.

@eric1234
Forked from dandean/Element#getHtml.js
Created November 13, 2012 02:44
Show Gist options
  • Save eric1234/4063653 to your computer and use it in GitHub Desktop.
Save eric1234/4063653 to your computer and use it in GitHub Desktop.
Adds outerHTML to Prototype
Element.addMethods 'getHtml': (element) ->
element = $ element
if 'outerHTML' of doc.documentElement
element.outerHTML
else
doc.documentElement('html').update(element.cloneNode(true)).innerHTML
@eric1234
Copy link
Author

Like the original but written in CoffeeScript. Also more concise (although perhaps memory leaks)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment