From 4d427243b74b43f93fba99d8f8e5936f03521bf9 Mon Sep 17 00:00:00 2001 From: biziclop <904630+biziclop@users.noreply.github.com> Date: Sun, 26 May 2019 01:35:42 +0200 Subject: [PATCH] "Returning an Empty Set" clarifications MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …when passing null/undefined/[]/"" https://github.com/jquery/api.jquery.com/issues/1136 --- entries/jQuery.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entries/jQuery.xml b/entries/jQuery.xml index a0ff76d1..b31102b5 100644 --- a/entries/jQuery.xml +++ b/entries/jQuery.xml @@ -77,7 +77,7 @@ $.post( "url.xml", function( data ) {

When a jQuery object is passed to the $() function, a clone of the object is created. This new jQuery object references the same DOM elements as the initial one.

Returning an Empty Set

-

As of jQuery 1.4, calling the jQuery() method with no arguments returns an empty jQuery set (with a .length property of 0). In previous versions of jQuery, this would return a set containing the document node.

+

Calling the jQuery() method with no arguments returns an empty jQuery set (with a .length property of 0). Similarly, if an argument of null, undefined, an empty array ([]), or an empty string ("") is passed, the set contains no elements.

Working With Plain Objects

At present, the only operations supported on plain JavaScript objects wrapped in jQuery are: .data(),.prop(),.on(), .off(), .trigger() and .triggerHandler(). The use of .data() (or any method requiring .data()) on a plain object will result in a new property on the object called jQuery{randomNumber} (eg. jQuery123456789).