Created
January 19, 2016 23:39
-
-
Save garlicnation/e6137465ecd2ba9aa022 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// findBodyElements returns a document fragment containing | |
// all elements that should be moved into body from a document-order | |
// array of elements in head, searching from startIndex to endIndex | |
function findBodyElements(flatHead, startIndex, endIndex) { | |
if (endIndex === -1) { | |
endIndex = flatHead.length; | |
} | |
var container = dom5.constructors.fragment(); | |
for (var headidx = start, el; headidx < endIndex; headidx++) { | |
el = flatHead[headidx]; | |
// if the element is a script, move it to bodyFragment | |
if (matchers.JS(el)) { | |
dom5.append(container, el); | |
} | |
} | |
return container | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment