Skip to main content

Bug Tracker

Side navigation

#14427 closed feature (notabug)

Opened October 08, 2013 01:45AM UTC

Closed October 08, 2013 05:54PM UTC

Last modified October 08, 2013 05:59PM UTC

Change .add() to .and()

Reported by: me@bfred.it Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:
Description

The "add" name is confusing. Does it add to the original element list? Does it add it as a children?

$(this).and(that).doSomething(); would be more readable.

Attachments (0)
Change History (3)

Changed October 08, 2013 05:51PM UTC by anonymous comment:1

While we're at it, we could make it easy to add multiple elements:

$(this).and(that, them, others, ducks).doABarrelRoll();

Changed October 08, 2013 05:54PM UTC by rwaldron comment:2

resolution: → notabug
status: newclosed

Replying to [ticket:14427 me@…]:

The "add" name is confusing. Does it add to the original element list? Does it add it as a children?

It does what the docs say it does: "Add elements to the set of matched elements."

http://api.jquery.com/add/

Changed October 08, 2013 05:59PM UTC by me@bfred.it comment:3

So did .andSelf() when they changed it to .addBack()

.and() would be easier to read.

Also "Add elements to the set of matched elements." is confusing too. Does it change the original object? (I know the answer but it isn't clear to the uninitiated)