标签:jquer dem div document font person class 布尔 function
jQuery.isPlainObject()函数用于检查一个对象是否为普通对象(使用{}或者new Object创建)。
jQuery.isPlainObject(object)
需要进行判断是否为普通对象的对象。
注意:宿主对象(或由浏览器宿主环境使用的对象来完成ECMAScript的执行环境)有许多不一致的地方,这些不一致的特性很难被有力地检测到跨平台。因此,$.isPlainObject()在某些情况下可能会在不同的浏览器中得出不同的结果。
jQuery.isPlainObject()返回一个布尔值,如果指定的参数是普通的对象,则返回true,否则返回false。
$.isPlainObject({}); // true
$.isPlainObject(new Object()); // true
$.isPlainObject({name:"CodeMonkey"}); // true
$.isPlainObject("CodeMonkey"); // false
$.isPlainObject(true); // false
$.isPlainObject(12); // false
$.isPlainObject([]); // false
$.isPlainObject(function(){}); // false
$.isPlainObject(document.location); // Chrome,Firefox中返回false,IE中返回true
function Person(){ this.name = "CodeMonkey"; }
$.isPlainObject(new Person()); // false
标签:jquer dem div document font person class 布尔 function
原文地址:http://www.cnblogs.com/zwwhnly/p/7491061.html