()
| 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') { |
no test coverage detected