MCPcopy Create free account
hub / github.com/microsoft/SandDance / conditionalHeader

Function conditionalHeader

docs/tests/v2/es6/js/sanddance.js:153833–153843  ·  view source on GitHub ↗
(condition, element, header)

Source from the content-addressed store, hash-verified

153831}
153832
153833function conditionalHeader(condition, element, header) {
153834 var existing = existingHeader(element, header);
153835
153836 if (condition && !existing) {
153837 addHeader(element, header);
153838 }
153839
153840 if (!condition && existing) {
153841 existing.remove();
153842 }
153843}
153844
153845function addHeader(element, header) {
153846 const h = document.createElement('h4');

Callers 1

ensureHeadersFunction · 0.70

Calls 3

existingHeaderFunction · 0.70
addHeaderFunction · 0.70
removeMethod · 0.45

Tested by

no test coverage detected