Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is probably the biggest hole in vanilla js. In particular building a large DOM structure requires so many method calls.

jQuery lets one use an innerHTML-ish style, but it is supposedly guarding against injection attacks in some way. I don't like the hand-wavy way it claims to guard against injections, as basically it has no way to tell what part of a string was meant to be text, and what was meant to be elements.

So I ended up coding my own library. No conversion of strings to elements, so naturally no injections. Very small and simple. But saves a ton of typing when generating DOM structures in JavaScript: https://github.com/NoHatCoder/DOM_Maker



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: