CS Fundamentals Trainer · JavaScript · Security

Which of these insert an untrusted string input into the DOM without it being parsed as HTML?

Which of these insert an untrusted string `input` into the DOM without it being parsed as HTML?

  1. `el.textContent = input`
  2. `el.insertAdjacentHTML('beforeend', input)`
  3. `el.append(document.createTextNode(input))`
  4. `el.outerHTML = input`
  5. `el.setAttribute('title', input)`

Difficulty: medium

Answer this question

Related questions