Skip to content

Instantly share code, notes, and snippets.

@robwierzbowski
Created July 13, 2016 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robwierzbowski/4d6a19bb10302927234ec1dcbe895153 to your computer and use it in GitHub Desktop.
Save robwierzbowski/4d6a19bb10302927234ec1dcbe895153 to your computer and use it in GitHub Desktop.
/**
* 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