Created
July 13, 2016 19:30
-
-
Save robwierzbowski/4d6a19bb10302927234ec1dcbe895153 to your computer and use it in GitHub Desktop.
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
/** | |
* Return a reference to a document fragment's content that persists when the | |
* fragment's content is inserted into the DOM | |
* http://stackoverflow.com/a/13347298/530653z | |
* @param {DocumentFragment} fragment - fragment to return references from | |
* @returns {HTMLElement} A reference to the contents of fragment | |
*/ | |
const getReference = function(fragment) { | |
return [].slice.call(fragment.childNodes, 0)[0]; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment