Bug Tracker

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#13285 closed feature (wontfix)

Some jQuery's methods should return an array instead of plain text

Reported by: denislins Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 2.0b1
Keywords: Cc:
Blocked by: Blocking:

Description

Today, when I try to get values from some '<input>' elements with .val(), for example, I get just the value for the first input, and I think that's wrong.

When using .text() and .html(), it returns all values combined, with no choice of the separator, making it hard to work as well.

Fiddles: http://jsfiddle.net/ZXsqA/ (.text()) http://jsfiddle.net/rjmGH/1/ (.val())

I would suggest that this methods return an array with all values instead of the current behavior, facilitating our work when doing group operations.

Change History (5)

comment:1 Changed 6 years ago by timmywil

Resolution: wontfix
Status: newclosed
Version: git2.0b1

This would change jQuery too drastically.

comment:2 Changed 6 years ago by denislins

I agree, that's why I would suggest that this feature be included in jQuery 2.0. It's a new version, which by itself comes with some major changes, and nobody should upgrade without knowing the changes.

Besides the compatibility problem, I think most users will enjoy this new feature, as the current behavior is, at minimum, unexpected.

comment:3 Changed 6 years ago by Rick Waldron

that's why I would suggest that this feature be included in jQuery 2.0

While we certainly appreciate your contribution, we also appreciate our roadmap and game plan. The most important note is that jQuery 2.0 and 1.9 will maintain API and semantic parity for many years to come.

comment:4 Changed 6 years ago by denislins

Thank you a lot for your feedback.

Could a .textAll() method be implemented, according to your road map?

comment:5 Changed 6 years ago by Rick Waldron

Probably not, but this will cover your needs http://jsfiddle.net/rwaldron/aMvMs/

Note: See TracTickets for help on using tickets.