Generates a document fragment from a string, list of nodes, or a multi-line comment string
xtag.createFragment(CONTENT)
xtag.createFragment(CONTENT)
Argument | Type | Description |
---|---|---|
CONTENT | - String - Function-embedded Multi-line Comment String - Element Reference(s) | Pass in a string, function with a multi-line comment string of HTML, or element references, and a Document Fragment will be created from the contents |
var fragFromString = xtag.createFragment('<div>Hello World!</div>');
var fragFromReferences = xtag.createFragment(myDiv, myHeading);
var fragFromFunction = xtag.createFragment(function(){/*
<header>Hello</header>
<section>I'm a multi-line HTML fragment</section>
<footer>Goodbye</footer>
*/});