Bug Tracker

Modify

Ticket #6316 (closed bug: invalid)

Opened 4 years ago

Last modified 3 years ago

Some jQuery methods don't their check private variables.

Reported by: Larry Battle Owned by:
Priority: undecided Milestone: 1.4.3
Component: core Version: 1.4.2
Keywords: error Cc:
Blocking: Blocked by:

Description

When faced with no arguments, most methods error out with no problems or return a value. But... Each of the following method calls, starting with css, will return an error and stop the rest of the script.

$(document.body).css().each().filter().map().ready();
$(document.body).text('Test Completed.');

Demo:  http://jsbin.com/eriva/

Attachments

jQuery error - no arguments for methods.htm Download (2.4 KB) - added by Larry Battle 4 years ago.
jQuery Error - no arguments with methods

Change History

Changed 4 years ago by Larry Battle

jQuery Error - no arguments with methods

comment:1 Changed 4 years ago by dmethvin

What is the suggested behavior for these cases?

comment:2 Changed 4 years ago by Larry Battle

jQuery should just return the jquery object to fail safe.

if( !arguments.length ){ return this; }

comment:3 Changed 4 years ago by dmethvin

  • Component changed from unfiled to core

comment:4 Changed 3 years ago by rwaldron

  • Priority set to undecided
  • Status changed from new to closed
  • Resolution set to invalid

The cases are all incorrect uses of the methods per the documentation and api.

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.