forked from jquery/api.jquery.com
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjQuery.type.xml
More file actions
50 lines (50 loc) · 2.47 KB
/
jQuery.type.xml
File metadata and controls
50 lines (50 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?xml version="1.0"?>
<entry type="method" name="jQuery.type" return="String" deprecated="3.3" removed="4.0">
<title>jQuery.type()</title>
<signature>
<added>1.4.3</added>
<argument name="obj" type="Anything">
<desc>Object to get the internal JavaScript [[Class]] of.</desc>
</argument>
</signature>
<desc>Determine the internal JavaScript [[Class]] of an object.</desc>
<longdesc>
<div class="warning">
<p>Note: This API has been deprecated in jQuery 3.3.</p>
</div>
<p>A number of techniques are used to determine the exact return value for an object. The [[Class]] is determined as follows:</p>
<ul>
<li>If the object is undefined or null, then "undefined" or "null" is returned accordingly.
<ul>
<li>jQuery.type( undefined ) === "undefined"</li>
<li>jQuery.type() === "undefined"</li>
<li>jQuery.type( window.notDefined ) === "undefined"</li>
<li>jQuery.type( null ) === "null"</li>
</ul>
</li>
<li>If the argument is either a primitive value or an instance of a standard built-in ECMAScript object, the [[Class]] internal property is used to determine the type. (<a href="http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write-a-robust-isarray/">More details about this technique.</a>)
<ul>
<li>jQuery.type( true ) === "boolean"</li>
<li>jQuery.type( new Boolean() ) === "boolean"</li>
<li>jQuery.type( 3 ) === "number"</li>
<li>jQuery.type( new Number( 3 ) ) === "number"</li>
<li>jQuery.type( "test" ) === "string"</li>
<li>jQuery.type( new String( "test" ) ) === "string"</li>
<li>jQuery.type( function() {} ) === "function"</li>
<li>jQuery.type( [] ) === "array"</li>
<li>jQuery.type( new Array() ) === "array"</li>
<li>jQuery.type( new Date() ) === "date"</li>
<li>jQuery.type( new Error() ) === "error" // <strong>as of jQuery 1.9</strong></li>
<li>jQuery.type( Symbol() ) === "symbol" // <strong>as of jQuery 1.9</strong></li>
<li>jQuery.type( Object( Symbol() ) ) === "symbol" // <strong>as of jQuery 1.12</strong></li>
<li>jQuery.type( /test/ ) === "regexp"</li>
</ul>
</li>
<li>Everything else returns "object" as its type.</li>
</ul>
</longdesc>
<category slug="utilities"/>
<category slug="version/1.4.3"/>
<category slug="deprecated/deprecated-3.3"/>
<category slug="removed"/>
</entry>