4 ms·
If the JSON itself contains strings with markup included, and you're injecting directly into a script tag in the HTML document. Though, if you're dealing with
by tracker1 7y ago
If the JSON itself contains strings with markup included, and you're injecting directly into a script tag in the HTML document.
Though, if you're dealing with a typed object server-side and/or loading into a .js file request, it's less of an issue, if you aren't supporting html markup in the object to begin with. In my own use case, both are true.
- Sephr 7y agoHence why I said "You should be using appropriate DOM APIs"... The appropriate DOM APIs don't take HTML strings in the first place. You shouldn't be passing HTML strings to JS.