Bug Tracker

Modify

Ticket #3666 (closed enhancement: fixed)

Opened 5 years ago

Last modified 5 years ago

Remove dead code from $(fn) shortcut for $(document).ready(fn)

Reported by: geary Owned by: flesler
Priority: trivial Milestone: 1.3
Component: core Version: 1.2.6
Keywords: Cc: geary
Blocking: Blocked by:

Description

The code for the $(fn) shortcut is:

return jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector );

It's unclear what the intent of this code was, but the jQuery.fn.ready test has no effect. jQuery.fn.ready always exists, so the code is the equivalent of:

return jQuery( document ).ready( selector );

That also matches people's expectation that $(fn) is the exact equivalent of $(document).ready(fn).

The attached patch removes this dead code.

Attachments

readyshortcut.patch Download (402 bytes) - added by geary 5 years ago.
Patch to remove dead code from $(fn)

Change History

Changed 5 years ago by geary

Patch to remove dead code from $(fn)

comment:1 Changed 5 years ago by flesler

  • Cc geary added
  • Owner set to flesler
  • Status changed from new to assigned

comment:2 Changed 5 years ago by flesler

  • Status changed from assigned to closed
  • Resolution set to fixed

Applied at [5997]. Thanks.

comment:3 Changed 5 years ago by flesler

  • Type changed from bug to enhancement

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.