MCPcopy Index your code
hub / github.com/json-editor/json-editor / updateHeaderText

Method updateHeaderText

src/editor.js:505–522  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

503 }
504
505 updateHeaderText () {
506 if (this.header) {
507 const headerText = this.getHeaderText()
508 /* If the header has children, only update the text node's value */
509 if (this.header.children.length) {
510 for (let i = 0; i < this.header.childNodes.length; i++) {
511 if (this.header.childNodes[i].nodeType === 3) {
512 this.header.childNodes[i].nodeValue = this.cleanText(headerText)
513 break
514 }
515 }
516 /* Otherwise, just update the entire node */
517 } else {
518 if (window.DOMPurify) this.header.innerHTML = window.DOMPurify.sanitize(headerText)
519 else this.header.textContent = this.cleanText(headerText)
520 }
521 }
522 }
523
524 purify (val) {
525 if (typeof val !== 'string') {

Callers 2

postBuildMethod · 0.95
onWatchedFieldChangeMethod · 0.95

Calls 3

getHeaderTextMethod · 0.95
cleanTextMethod · 0.95
sanitizeMethod · 0.45

Tested by

no test coverage detected