Bug Tracker

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#14427 closed feature (notabug)

Change .add() to .and()

Reported by: me@… 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.

Change History (3)

comment:1 Changed 10 years ago by anonymous

While we're at it, we could make it easy to add multiple elements: $(this).and(that, them, others, ducks).doABarrelRoll();

comment:2 in reply to:  description Changed 10 years ago by Rick Waldron

Resolution: notabug
Status: newclosed

Replying to 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/

comment:3 Changed 10 years ago by me@…

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)

Note: See TracTickets for help on using tickets.