Bug Tracker

Opened 7 years ago

Closed 5 years ago

#9469 closed feature (fixed)

Remove semi-functional .selector calculation from .pushStack()

Reported by: dmethvin Owned by: dmethvin
Priority: low Milestone: 1.9
Component: core Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:

Description

Per discussion with ben_alman, and related to #7389 which consensus says won't happen.

The .selector property can't be reliable since there are simple ways to construct a set that can't be represented by a CSS selector. We've documented those shortcomings in the API docs for .live() and .selector but it's still a frequent source of questions and errors.

It would simplify the code for .pushStack() and its callers if it didn't try to maintain the .selector property at all, which is still in keeping with our documented use of .live() immediately after a $() set creation.

In addition we should deprecate non-core use of .selector and remove the documentation from the API site eventually.

All to be done over several versions, with sufficient advance warning in the docs before breaking anything.

Change History (9)

comment:1 Changed 7 years ago by timmywil

Component: unfiledcore
Priority: undecidedlow
Status: newopen

comment:2 Changed 7 years ago by cowboy

See my 3rd idea here: https://gist.github.com/1000934

comment:3 Changed 6 years ago by john

Resolution: invalid
Status: openclosed

Eventually we should do this, for sure, but only when we have some alternative to switch to. Right now we're using .selector inside jQuery for live so we definitely want to maintain it.

comment:4 Changed 6 years ago by anonymous

A quick question:

Since .selector seems to have been removed from the docs, and .live doesn't support chaining, would it be possible to remove the .selector constructing code in .pushStack now?

comment:5 Changed 6 years ago by dmethvin

Resolution: invalid
Status: closedreopened

Hmmm, it might. We still need to set .selector since .live() needs it, but the only other chaining I've seen in the wild is $(sel).find(sel).live(). Reopening to take a look around.

comment:6 Changed 6 years ago by timmywil

Status: reopenedopen

comment:7 Changed 5 years ago by dmethvin

Milestone: 1.next1.9
Owner: set to dmethvin
Status: openassigned

comment:8 Changed 5 years ago by dmethvin

Type: enhancementfeature

Bulk change from enhancement to feature.

comment:9 Changed 5 years ago by Dave Methvin

Resolution: fixed
Status: assignedclosed

Fix #9469. Remove semi-functional .selector property. Close gh-1006.

Saved 65 bytes.

Changeset: 69e2f068fe7d16c1ccd6cb99c6376f0d8891ea33

Note: See TracTickets for help on using tickets.