4 ms·
Laconic does [1], this library does not [2]. Laconic uses createTextNode, this uses innerHTML. [1]: https://github.com/joestelmach/laconic/blob/master/laconic.
by jrajav 14y ago
Laconic does [1], this library does not [2]. Laconic uses createTextNode, this uses innerHTML.
[1]: https://github.com/joestelmach/laconic/blob/master/laconic.js#L71 https://github.com/joestelmach/laconic/blob/master/laconic.j...
[2]: https://github.com/markgandolfo/el.js/blob/master/el.js#L48 https://github.com/markgandolfo/el.js/blob/master/el.js#L48
By the way, HTML encoding is fairly simple, you just have to be sure you get it right. This is a function for it that I include in most projects where I don't already have something like jQuery or laconic: https://gist.github.com/jrajav/5204669 https://gist.github.com/jrajav/5204669
- glitchdout 14y agoI've only recently started to dabble with javascript and its pitfalls such as XSS attacks. Using jQuery was the only solution I found to escape user generated and that gist will come in handy when I don't want to depend on that framework. Thank you for that.