Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#11428 closed bug (duplicate)

$(document).one('focus', selector, function) does fires more that once.

Reported by: bart@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:


one is triggered more than once when the selector is used on one function


<input data-autocomplete-source="/QuickSearchCity" name="CityName" type="text">
<input data-autocomplete-source="/QuickSearchCountry" name="CountryName" type="text">

<input type="text" id="result" /> 


(function ($) {
    var i=0;
    $(document).one('focus', 'input[type="text"][data-autocomplete-source]', function () {

FIDDLE: http://jsfiddle.net/wybre/3/

Change History (3)

comment:1 Changed 12 years ago by dmethvin

Keywords: needsdocs added
Resolution: duplicate
Status: newclosed

We discussed this in #jquery-dev today, the actual bug is fixed in (edge) but we could use a clarification in the .one() api docs that for the delegated events case the one-ness *still* applies only to the element(s) where you are attaching the event. You do not get one handler run per matching selector, that would require keeping the event permanently attached so that some future element that appears would get its one shot at fame as well.

comment:2 Changed 12 years ago by dmethvin

Duplicate of #10984.

comment:3 Changed 12 years ago by dmethvin

Keywords: needsdocs removed
Note: See TracTickets for help on using tickets.