$().text() 和 $().html()
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'
.innerHTMLis ~3x faster than.html(). - pure JS'
.nodeValueis ~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()更安全
随机推荐
- php 防止SQL注入函数
function inject_check($sql_str) { return eregi('select|insert|and|or|update|delete|\'|\/\*|\*|\.\.\/ ...
- Python交互模式下方向键出现乱码
解决办法如下: 1.安装readline模块 readline库是bash shell用的库,包含许多功能,如命令行自动补全等. ubuntu下安装的命令: sudo apt-get instal ...
- 转:enum与typedef enum的用法
来自:http://blog.sina.com.cn/s/blog_817a5eb6010146ad.html 作者:于超峰 在程序中,可能需要为某些整数定义一个别名,我们可以利用预处理指令#defi ...
- 涂抹Oracle—Flashback
11.1 基于flashback查询过去的数据 a.基于时间的查询(as of timestamp) 构造表falsh_tbl,删除数据然后查询 SQL>select * from flash ...
- PHP vs Java
http://www.phpddt.com/reprint/php_font-java_end.html http://www.zhihu.com/question/20314377 http://b ...
- 完整的开发一个ContentProvider步骤
1.定义自己的ContentProvider类,该类需要继承Android提供的ContentProvider基类.2.向Android系统注册这个"网站",也就是在Android ...
- Gridview中的数据导出到excel中
protected void btnExport_Click(object sender, EventArgs e) { //导出全部数据,取消分页 ...
- 对编程语言的需求总结为四个:效率,灵活,抽象,生产率(C++玩的是前三个,Java和C#玩的是后两个)
Why C++ ? 王者归来(转载) 因为又有人邀请我去Quora的C2C网站去回答问题去了,这回是 关于 @laiyonghao 的这篇有点争议的博文<2012 不宜进入的三个技术点>A ...
- 交叉编译环境以及开发板上-/bin/sh: ./hello: not found(使用arm-linux-gcc -static -o 来进行静态编译)
目标板是S3C2440.至于交叉编译环境的搭建就不多说了,网上很多教程. 搭建好了交叉编译环境后,第一件事就是传说中的”Hello,World!”. 一. 主机编译环节 我使用的系统是ubuntu10 ...
- Jquery 对象集合的迭代扩展forEach
if (jQuery && !jQuery.fn.forEach) { $(function () { (function ($) { $.fn.extend({ forEach: f ...