From 185bb9516c921385b0bdfa85f1947f60dad506f5 Mon Sep 17 00:00:00 2001 From: Tom Fuertes Date: Sun, 6 Jul 2014 15:37:48 -0500 Subject: [PATCH] one(): Fix description of behavior for delegated .one() events Refs #489 (specifically #issuecomment-42754794) and updates the preceding paragraph appropriately. --- entries/one.xml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/entries/one.xml b/entries/one.xml index 3b53235e..1327dbf0 100644 --- a/entries/one.xml +++ b/entries/one.xml @@ -44,13 +44,10 @@ -

The first form of this method is identical to .bind(), except that the handler is unbound after its first invocation. The second two forms, introduced in jQuery 1.7, are identical to .on() except that the handler is removed after the first time the event occurs at the delegated element, whether the selector matched anything or not. For example:

+

The .one() method is identical to .on(), except that the handler is unbound after its first invocation. For example:


 $( "#foo" ).one( "click", function() {
   alert( "This will be displayed only once." );
-});
-$( "body" ).one( "click", "#foo", function() {
-  alert( "This displays the first time #foo is clicked in the body." );
 });
     

After the code is executed, a click on the element with ID foo will display the alert. Subsequent clicks will do nothing. This code is equivalent to: