Created
June 4, 2012 22:37
-
-
Save gcpantazis/2871256 to your computer and use it in GitHub Desktop.
Add jQuery support for outerHTML, with feature detection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add support for outerHTML, which in FF was only added at version 11. | |
// Only use elem.outerHTML once support for FF<11 is no longer needed. | |
(function($){ | |
$.fn.outerHTML = function() { | |
var a = this.get(0).outerHTML; | |
return a ? a : $('<p/>').append(this.clone()).html(); | |
} | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment