On 12-08-28 10:40 AM, Trevor Parscal wrote:
Rob is correct that using addClass is the preferable
way to go for classes,
and attr is the preferable way to go for other attributes. They are both
are safe since they use setAttribute internally which escapes the values.
In creating elements, maybe, but after creation, $.prop() is the
preferred way to go because the DOM properties are more reliably synced
with the actual state of the UI--apparently jQuery doesn't always
properly sync the HTML attributes to the browser state. I'm sure Timo
can explain more fully (and maybe more accurately).
--
Mark Holmquist
Contractor, Wikimedia Foundation
mtraceur(a)member.fsf.org
http://marktraceur.info