5 ms·
Nice! I was going to suggest the usage of Trusted Types API [0] to escape HTML [1], but support [2] for modern browsers is not there yet, specifically for HTML.
by rickstanley 4y ago
Nice! I was going to suggest the usage of Trusted Types API [0] to escape HTML [1], but support [2] for modern browsers is not there yet, specifically for HTML.
0: https://developer.mozilla.org/en-US/docs/Web/API/Trusted_Types_API https://developer.mozilla.org/en-US/docs/Web/API/Trusted_Typ...
1: https://github.com/1Marc/todomvc-vanillajs-2022/blob/1c31309be3cf64936418d60539b8cbf4eab78dc3/js/helpers.js#L4-L10 https://github.com/1Marc/todomvc-vanillajs-2022/blob/1c31309...
2: https://developer.mozilla.org/en-US/docs/Web/API/TrustedHTML#browser_compatibility https://developer.mozilla.org/en-US/docs/Web/API/TrustedHTML...
- grabanski 4y agoCool! I'll look into the API and consider adding it to this implementation. Or happily would take a look at a PR for it.
- randomfool 4y agoSeriously- just do the innerHTML assignment on li.innerHTML omitting the title, followed up by a simple li.querySelector().textContent = todo.title.
- grabanski 4y agoHow does this look? https://github.com/1Marc/todomvc-vanillajs-2022/commit/d38e58e9be4a7dacc74aeff889869fc0bea27a1d https://github.com/1Marc/todomvc-vanillajs-2022/commit/d38e5...