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

Function trimNode

01.GettingStarted/js/vue.js:1398–1408  ·  view source on GitHub ↗

* Trim possible empty head/tail text and comment * nodes inside a parent. * * @param {Node} node

(node)

Source from the content-addressed store, hash-verified

1396 */
1397
1398 function trimNode(node) {
1399 var child;
1400 /* eslint-disable no-sequences */
1401 while ((child = node.firstChild, isTrimmable(child))) {
1402 node.removeChild(child);
1403 }
1404 while ((child = node.lastChild, isTrimmable(child))) {
1405 node.removeChild(child);
1406 }
1407 /* eslint-enable no-sequences */
1408 }
1409
1410 function isTrimmable(node) {
1411 return node && (node.nodeType === 3 && !node.data.trim() || node.nodeType === 8);

Callers 4

extractContentFunction · 0.70
stringToFragmentFunction · 0.70
nodeToFragmentFunction · 0.70
parseTemplateFunction · 0.70

Calls 1

isTrimmableFunction · 0.70

Tested by

no test coverage detected