Re:Because Spain won, jQuery: Novice to Ninja is free for 24...
by tptacek on Sunday July 11, 2010 @11:20PM
(#1506686)
I think the suggestion is that programmatically creating specific DOM nodes is safer than handing the library a string containing user input and hoping that the browser doesn't interpret it in a way that corrupts the DOM.
[ Parent
| on HN ]
Re:Because Spain won, jQuery: Novice to Ninja is free for 24...
by sdesol on Sunday July 11, 2010 @11:36PM
(#1506719)
I certainly agree with this but I think it's misleading to say it increases your chances for xss security threats. I can see it increasing the chances of having a webpage not behave properly across all browsers though.
Re:Because Spain won, jQuery: Novice to Ninja is free for 24...
by mhansen on Monday July 12, 2010 @01:15AM
(#1506898)
Say some "<script>do_bad_stuff();</script>" got through from some source you just expected to have text. (e.g. this happened for youtube the other day)
If you insert this into the DOM with html(), it will execute the script, doing bad things. If you insert it into the dom with e.g. text(), it won't be interpreted.