$().text()和$().html()

王朝学院·作者佚名  2016-08-27
窄屏简体版  字體: 小  |  中  |  大  |  超大  

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()更安全

 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
© 2005- 王朝網路 版權所有 導航