MCPcopy Index your code
hub / github.com/cure53/DOMPurify / deepTree

Function deepTree

scripts/benchmark.js:76–98  ·  view source on GitHub ↗
(depth, breadth)

Source from the content-addressed store, hash-verified

74/* ------------------------------------------------------------------ */
75
76function deepTree(depth, breadth) {
77 // Nested structure exercising the element walk; text-only leaves
78 // exercise the SAFE_FOR_XML innerHTML/textContent probes.
79 let html = '';
80 const open = [];
81 const build = (d) => {
82 if (d === 0) {
83 html += '<p>leaf text node without any markup characters</p>';
84 return;
85 }
86
87 html += `<div class="level-${d}">`;
88 open.push('</div>');
89 for (let i = 0; i < breadth; i++) {
90 build(d - 1);
91 }
92
93 html += open.pop();
94 };
95
96 build(depth);
97 return html;
98}
99
100function wideAttrs(n) {
101 // Attribute-heavy flat list: exercises _sanitizeAttributes /

Callers 1

benchmark.jsFile · 0.85

Calls 1

buildFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…