* Extract raw content inside an element into a temporary * container div * * @param {Element} el * @param {Boolean} asFragment * @return {Element|DocumentFragment}
(el, asFragment)
| 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 |
no test coverage detected