$().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()更安全
随机推荐
- 淘宝接口实现ip归属地查询
<?php header('content-type:text/html;charset=utf-8'); /*获取当前ip归属地 调用淘宝接口 */ function get_ip_place ...
- arclist标签和list标签区别
很多站长朋友在刚入门织梦的时候对织梦的标签存在很多的困惑,关于arclist标签和list标签,甚至不知道啥时候用arclist,啥时用list标签.arclist 为自由列表,全局模板中都生效,一般 ...
- Hibernate数据库对象的创建与导出
Hibernate 与数据库的关系是ORM关系,对象映射数据库. 那么如何通过对象对数据库进行各种对象的ddl与dml操作呢? 数据库对象操作的〈database-object /〉+ SchemaE ...
- IOS NSUserDefaults 讲解 用法
IOS NSUserDefaults 讲解 用法 NSUserDefaults适合存储轻量级的本地数据,比如要保存一个登陆界面的数据,用户名.密码之类的,个人觉得使用NSUserDefaults ...
- 【转】Beaglebone Black
原文网址:http://bbs.eeworld.com.cn/thread-431409-1-1.html 开源硬件在国外火得一塌糊涂,国内却没有那么多人玩,直接导致中文论坛资料严重缺乏……但这也挡不 ...
- 深入 JavaScript(6) - 一静一动
这里是JavaScript核心的内容了. 挺多的JavaScript测试题也是围绕这个出的. 这里的一静一动指的是: 静, 词法作用域 - Lexical scoping 动, 动态绑定this的值 ...
- android SimpleCursorAdapter的使用
String[] fields=new String[]{"foodname","price","taste","stuff&qu ...
- Codeforces Round #301 (Div. 2) E . Infinite Inversions 树状数组求逆序数
E. Infinite Inversions ...
- Hadoop2.4.1 64-Bit QJM HA and YARN HA + Zookeeper-3.4.6 + Hbase-0.98.8-hadoop2-bin HA Install
Hadoop2.4.1 64-Bit QJM HA and YARN HA Install + Zookeeper-3.4.6 + Hbase-0.98.8-hadoop2-bin HA(Hadoop ...
- appium 使用findElementByAndroidUIAutomator 定位元素示例
appium 使用findElementByAndroidUIAutomator 定位元素示例 import io.appium.java_client.remote.MobileCapability ...