Disallow Element.prototype.innerHTML in favor of Element.prototype.textContent (github/no-inner-html)
March 23, 2023 ยท View on GitHub
๐ผ This rule is enabled in the ๐ browser config.
Rule Details
Using innerHTML poses a potential security risk. Prefer using textContent to set text to an element.
It may be reasonable to disable this rule in testing setups that use known, trusted input and carry little security risk.
๐ Examples of incorrect code for this rule:
function setContent(element, content) {
element.innerHTML = content
}
๐ Examples of correct code for this rule:
function setContent(element, content) {
element.textContent = content
}
Version
4.3.2