Skip to content

Commit

Permalink
jQuery.type: clean up formatting, note error type added 1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
kswedberg committed Jan 18, 2013
1 parent 139441a commit cec60cb
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions entries/jQuery.type.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,24 @@
<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>
<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 object has an internal [[Class]] equivalent to one of the browser's built-in objects, the associated name is returned. (<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(3) === "number"</li><li>jQuery.type("test") === "string"</li><li>jQuery.type(function(){}) === "function"</li><li>jQuery.type([]) === "array"</li><li>jQuery.type(new Date()) === "date"</li><li>jQuery.type(new Error()) === "error"</li><li>jQuery.type(/test/) === "regexp"</li></ul>
<ul>
<li>jQuery.type( true ) === "boolean"</li>
<li>jQuery.type( 3 ) === "number"</li>
<li>jQuery.type( "test" ) === "string"</li>
<li>jQuery.type( function(){} ) === "function"</li>
<li>jQuery.type( [] ) === "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( /test/ ) === "regexp"</li>
</ul>
</li>
<li>Everything else returns "object" as its type.</li>
</ul>
Expand All @@ -27,4 +41,4 @@
</example>
<category slug="utilities"/>
<category slug="version/1.4.3"/>
</entry>
</entry>

0 comments on commit cec60cb

Please sign in to comment.