Bug Tracker

Opened 6 years ago

Closed 4 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:


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 6 years ago by timmywil

  • Component changed from unfiled to core
  • Priority changed from undecided to low
  • Status changed from new to open

comment:2 Changed 6 years ago by cowboy

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

comment:3 Changed 6 years ago by john

  • Resolution set to invalid
  • Status changed from open to closed

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 5 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 5 years ago by dmethvin

  • Resolution invalid deleted
  • Status changed from closed to reopened

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 5 years ago by timmywil

  • Status changed from reopened to open

comment:7 Changed 5 years ago by dmethvin

  • Milestone changed from 1.next to 1.9
  • Owner set to dmethvin
  • Status changed from open to assigned

comment:8 Changed 5 years ago by dmethvin

  • Type changed from enhancement to feature

Bulk change from enhancement to feature.

comment:9 Changed 4 years ago by Dave Methvin

  • Resolution set to fixed
  • Status changed from assigned to closed

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

Saved 65 bytes.

Changeset: 69e2f068fe7d16c1ccd6cb99c6376f0d8891ea33

Note: See TracTickets for help on using tickets.