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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | 39x 16x 16x 16x 16x 16x 16x 39x 790x 790x 790x 77x 77x 33x 77x 39x 359x 359x 359x 514x 359x 359x 514x 514x 514x 256x 345x 256x 256x 256x 16x 16x 19x 16x 3x 240x 256x 16x 16x 16x 16x 16x 240x 514x 498x | 'use strict';
import "core-js/modules/es.symbol.js";
import "core-js/modules/es.symbol.description.js";
import "core-js/modules/es.symbol.iterator.js";
import "core-js/modules/es.array.filter.js";
import "core-js/modules/es.array.for-each.js";
import "core-js/modules/es.array.includes.js";
import "core-js/modules/es.array.iterator.js";
import "core-js/modules/es.array.map.js";
import "core-js/modules/es.object.to-string.js";
import "core-js/modules/es.regexp.exec.js";
import "core-js/modules/es.string.includes.js";
import "core-js/modules/es.string.iterator.js";
import "core-js/modules/es.string.replace.js";
import "core-js/modules/es.string.trim.js";
import "core-js/modules/web.dom-collections.for-each.js";
import "core-js/modules/web.dom-collections.iterator.js";
/* istanbul ignore next */
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
import { getProp } from './utils';
import { applyCustomFilter } from './filters';
import { buildDelimiterRegex, evaluateTemplateExpression } from './helpers';
// Returns the value of a placeholder.
var getPlaceholderVal = function getPlaceholderVal(comp, placeholder, pointers) {
// if ( /{([^}]+)}/.test(placeholder) === false ) return;
if (_typeof(pointers) === 'object' && pointers !== null) {}
// placeholder is the inner content (without delimiters), may contain property path and filters already removed
var placeholderName = placeholder;
var propKeys = placeholderName.split('.');
var result = getProp(comp, propKeys, pointers);
// Return empty text instead of undefined.
Iif (result === undefined) return '';
return result;
};
// Replaces all placeholders in all attributes in a node.
export var updateAttributePlaceholders = function updateAttributePlaceholders(comp, node, pointers, cache) {
var attrs = node.attributes;
var regex = buildDelimiterRegex(comp.delimiters);
for (var i = 0; i < attrs.length; i++) {
var attrValue = attrs[i].value;
attrValue = attrValue.replace(regex, function (fullMatch, inner) {
return evaluateTemplateExpression(comp, pointers, node, inner, cache);
});
attrs[i].value = attrValue;
}
};
// Updates all the text nodes that contain placeholders `{}` and applies filters (if any).
export var updateTextNodePlaceholders = function updateTextNodePlaceholders(comp, nodeTree, pointers, cache) {
var textWalker = document.createTreeWalker(nodeTree, NodeFilter.SHOW_TEXT, null, false);
var nodesToProcess = [];
while (textWalker.nextNode()) {
nodesToProcess.push(textWalker.currentNode);
}
// Build delimiter-aware regex
var regex = buildDelimiterRegex(comp.delimiters);
nodesToProcess.forEach(function (node) {
var nodeVal = node.nodeValue;
var hasReplacedWithHTML = false;
nodeVal = nodeVal.replace(regex, function (fullMatch, inner) {
var parts = inner.split('|').map(function (p) {
return p.trim();
}).filter(Boolean);
var propName = parts.shift();
var filterList = parts;
var placeholderVal;
if (filterList.includes('asHTML')) {
placeholderVal = getPlaceholderVal(comp, propName, pointers);
filterList.forEach(function (filter) {
if (filter === 'asHTML') {
hasReplacedWithHTML = true;
} else {
placeholderVal = applyCustomFilter(comp, placeholderVal, filter);
}
});
} else {
placeholderVal = evaluateTemplateExpression(comp, pointers, node, inner, cache);
}
if (filterList.includes('asHTML')) {
// Replace the node with HTML fragment
var docFrag = document.createRange().createContextualFragment(placeholderVal);
node.parentNode.insertBefore(docFrag, node);
node.parentNode.removeChild(node);
hasReplacedWithHTML = true;
return '';
}
return placeholderVal;
});
// Update the node value only if it hasn't been replaced by HTML
if (!hasReplacedWithHTML && node.parentNode) {
node.nodeValue = nodeVal;
}
});
}; |