1:性能stackflow:http://stackoverflow.com/questions/1910794/what-is-the-difference-between-jquery-text-and-htmldemo:http://jsfiddle.net/PhJNX/ ...
1:性能
stackflow:http://stackoverflow.com/questions/1910794/what-is-the-difference-between-jquery-text-and-html
demo:http://jsfiddle.net/PhJNX/
- jQuery's
.html()
is ~2x faster than .text()
. - pure JS'
.innerHTML
is ~3x faster than .html()
. - pure JS'
.nodeValue
is ~50x faster than .html()
, ~100x than .text()
, and ~20x than .innerHTML
.
2:安全
stackflow:http://stackoverflow.com/questions/9735045/is-jquery-text-method-xss-safe
demo:http://jsfiddle.net/TLu69/
$().text()更安全
原标题:$().text() 和 $().html()
关键词:HTML
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。