jQuery.isPlainObject( object )Возвращает: Boolean
Описание: Проверяет, является ли заданный элемент пользовательским объектом, то есть он был задан пользователем именно в роли объекта (посредством "{}" или "new Object")(дело в том, что многие величины (например строки) в javascript являются объектами, однако они не задаются объектами явным образом).
-
Добавлен в версии: 1.4jQuery.isPlainObject( object )
-
objectТип: PlainObjectThe object that will be checked to see if it's a plain object.
-
Note: Host objects (or objects used by browser host environments to complete the execution environment of ECMAScript) have a number of inconsistencies which are difficult to robustly feature detect cross-platform. As a result of this, $.isPlainObject()
may evaluate inconsistently across browsers in certain instances.
An example of this is a test against document.location
using $.isPlainObject()
as follows:
1
|
|
which throws an invalid pointer exception in IE8. With this in mind, it's important to be aware of any of the gotchas involved in using $.isPlainObject()
against older browsers. A couple basic examples that do function correctly cross-browser can be found below.