4 ms·
Does rendering attributes using jQuery's text() method[1] properly sanitize the model attributes too? I ask because I'm making a backbone app and I'm following
by bricestacey 16y ago
Does rendering attributes using jQuery's text() method[1] properly sanitize the model attributes too?
I ask because I'm making a backbone app and I'm following the same process found in Ben Nolan's mobile app [2] where he does something like
this.el.find('h1').text("Editing " + (this.model.getName()));
[1] http://api.jquery.com/text/
[2] https://github.com/bnolan/Backbone-Mobile/blob/master/application.js
- jashkenas 16y agoYes. jQuery's text() method will properly escape HTML fragments. It's just a bit more verbose and a bit slower than using .escape("attribute") within a template.