All files processing.js

94.44% Statements 17/18
90% Branches 9/10
100% Functions 1/1
93.75% Lines 15/16

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33          39x 741x 741x 735x 214x 147x 147x 147x 43x 43x         692x   698x   668x 376x 376x              
import "core-js/modules/es.function.name.js";
import { updateAttributePlaceholders } from './placeholders';
 
// Processes nodes recursivelly in reverse. Evaluates the nodes based on their attributes.
// Removes and skips the nodes that evaluate to false.
var _processNode = function processNode(comp, node, pointers, cache) {
  var attrs = node.attributes;
  if (attrs) {
    for (var i = 0; i < attrs.length; i++) {
      if (attrs[i].name in comp.directives) {
        var attr = attrs[i].name;
        var result = comp.directives[attr](comp, node, pointers, cache);
        if (result === false) {
          node.remove();
          return;
        }
      }
    }
    // If a node stays in our tree (did not evaluate to false) then update all of its attributes.
    updateAttributePlaceholders(comp, node, pointers, cache);
  }
  if (node.hasChildNodes()) {
    // Iterate over the children in reverse because we might remove a node and the children count might change.
    for (var c = node.childElementCount - 1; c >= 0; c--) {
      if (node.children[c]) {
        _processNode(comp, node.children[c], pointers, cache);
      } else E{
        break;
      }
    }
  }
};
export { _processNode as processNode };