Vue · Junior · Question 39 of 75

Why is v-html dangerous?

<div v-html="comment.body"></div>

Explanation

Vue escapes {{ }} output, but v-html bypasses that. Only use it with trusted content or HTML sanitized by a library such as DOMPurify.

Further reading

Problem with a question

Vue · Junior · question 39

Test yourself

Take the Vue · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz