MCPcopy Index your code
hub / github.com/keepfool/vue-tutorials / extractContent

Function extractContent

01.GettingStarted/js/vue.js:1372–1389  ·  view source on GitHub ↗

* Extract raw content inside an element into a temporary * container div * * @param {Element} el * @param {Boolean} asFragment * @return {Element|DocumentFragment}

(el, asFragment)

Source from the content-addressed store, hash-verified

1370 */
1371
1372 function extractContent(el, asFragment) {
1373 var child;
1374 var rawContent;
1375 /* istanbul ignore if */
1376 if (isTemplate(el) && isFragment(el.content)) {
1377 el = el.content;
1378 }
1379 if (el.hasChildNodes()) {
1380 trimNode(el);
1381 rawContent = asFragment ? document.createDocumentFragment() : document.createElement('div');
1382 /* eslint-disable no-cond-assign */
1383 while (child = el.firstChild) {
1384 /* eslint-enable no-cond-assign */
1385 rawContent.appendChild(child);
1386 }
1387 }
1388 return rawContent;
1389 }
1390
1391 /**
1392 * Trim possible empty head/tail text and comment

Callers 2

vue.jsFile · 0.70
transcludeFunction · 0.70

Calls 3

isTemplateFunction · 0.70
isFragmentFunction · 0.70
trimNodeFunction · 0.70

Tested by

no test coverage detected