Bug Tracker

Modify

Ticket #10705 (closed bug: fixed)

Opened 2 years ago

Last modified 2 years ago

off bug event name parser

Reported by: Math. Owned by: dmethvin
Priority: low Milestone: 1.7.1
Component: event Version: 1.7
Keywords: Cc:
Blocking: Blocked by:

Description

Adding an extra space at the end or at the beginning of the event name will reset all previous event attached to the element.

Fix: apply "trim" to event name.

See it in action:  http://jsfiddle.net/8d6a6/

Change History

comment:1 follow-up: ↓ 3 Changed 2 years ago by rodneyrehm

.off() also does not unbind multiple space separated elements as seen in this fiddle:  http://jsfiddle.net/rodneyrehm/A5gvn/

comment:2 Changed 2 years ago by dmethvin

  • Owner set to dmethvin
  • Priority changed from undecided to low
  • Status changed from new to assigned
  • Component changed from unfiled to event
  • Milestone changed from None to 1.7.1

comment:3 in reply to: ↑ 1 ; follow-up: ↓ 4 Changed 2 years ago by Math.

Replying to rodneyrehm:

.off() also does not unbind multiple space separated elements as seen in this fiddle:  http://jsfiddle.net/rodneyrehm/A5gvn/

.off() also DOES unbind multiple space separated elements. You made a mistake, check:  http://jsfiddle.net/A5gvn/2/

comment:4 in reply to: ↑ 3 Changed 2 years ago by rodneyrehm

Replying to Math.:

Replying to rodneyrehm:

.off() also does not unbind multiple space separated elements as seen in this fiddle:  http://jsfiddle.net/rodneyrehm/A5gvn/

.off() also DOES unbind multiple space separated elements. You made a mistake, check:  http://jsfiddle.net/A5gvn/2/

The  docs state »One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin".«

So I'd expect .off(".namespace1 .namespace2 click keyup.namespace3") to remove all events of namespace [namespace1, namespace2], all click events and the keyup events of namespace3.

That is currently not the case. If the above mixing is not intended to work, the docs should state that accordingly.

comment:5 Changed 2 years ago by Dave Methvin

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

Fix #10705. Don't bail too soon in .off() event string processing.

Changeset: dd363d2c0f8d5eb03fe7beccff44a4a35887caa0

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.