Created
October 1, 2016 19:17
-
-
Save englishextra/0ff3204d5fb285ef058d72f31e3af766 to your computer and use it in GitHub Desktop.
append node into other with fragment
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
/*! | |
* append node into other with fragment | |
* gist.github.com/englishextra/0ff3204d5fb285ef058d72f31e3af766 | |
* @param {String|object} e an HTML Element to append | |
* @param {Object} a target HTML Element | |
* appendFragment(e,a) | |
*/ | |
var appendFragment=function(e,a){"use strict";a=a||d.getElementsByTagNames("body")[0]||"";var g=function(){if(e){var d=document,df=d.createDocumentFragment()||"",aC="appendChild";if("string"===typeof e){e=d.createTextNode(e);};df[aC](e);a[aC](df);}};return g();}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment