Opened 12 years ago
Closed 11 years ago
#9800 closed enhancement (fixed)
New method: .addBack (supersedes .andSelf)
Reported by: | cowboy | Owned by: | dmethvin |
---|---|---|---|
Priority: | low | Milestone: | 1.8 |
Component: | traversing | Version: | 1.6.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Ok. .andSelf
is somewhat confusingly named. What is "self" anyways? Let's come up with a better name for this method, and in the process, add a signature by which the previous-set-of-elements-to-be-added may be filtered. How about .addPrior
? It's like .add
but it specifically adds elements from the prior set.
Here's a version, as a plugin, with some usage examples: https://gist.github.com/1076570
Note: .andSelf
should just be aliased to this new method, and documented as deprecated. We wouldn't need to change the docs for .andSelf
, since it would still behave normally.
Change History (12)
comment:1 Changed 12 years ago by
Component: | unfiled → traversing |
---|---|
Priority: | undecided → low |
Status: | new → open |
Type: | bug → enhancement |
comment:2 Changed 11 years ago by
Milestone: | None → 1.8 |
---|
comment:3 Changed 11 years ago by
I like that this enhances the chain-stack analogy where filters/traversals/etc. push, .end()
pops, and .prevObject
peeks.
comment:4 Changed 11 years ago by
I've thought a bit more about this, and would like to propose .addBack
instead of .addPrior
: #11128
comment:5 Changed 11 years ago by
Owner: | set to Rick Waldron |
---|---|
Status: | open → assigned |
Noticed this was unowned for 1.8
comment:6 Changed 11 years ago by
Owner: | changed from Rick Waldron to dmethvin |
---|---|
Summary: | New method: .addPrior (supersedes .andSelf) → New method: .addBack (supersedes .andSelf) |
PR for discussion as .addBack()
.
comment:7 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:8 Changed 11 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
I'm re-opening this, because the second half of the ticket, "...in the process, add a signature by which the previous-set-of-elements-to-be-added may be filtered..." wasn't addressed, and I'd hate to see it get lost because it's so useful.
See https://gist.github.com/1076570 "find+filter" example for reference.
comment:10 Changed 11 years ago by
Status: | reopened → open |
---|
comment:12 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
jQuery#addBack supports an optional selector that can be used to filter the prior set before adding it back. Fixes #9800
Changeset: 02dd7c570bf4dbbdfc168f4352d04c667447be5d
Marking as valid, switching to enhancement and opening for discussion.