Skip to main content

Bug Tracker

Side navigation

#13471 closed bug (fixed)

Opened February 18, 2013 11:02AM UTC

Closed February 26, 2013 05:23PM UTC

Last modified February 26, 2013 05:26PM UTC

Stack overflow if element which binded pure namespace event unbind a pure namespace event

Reported by: c4605 Owned by: rwaldron
Priority: low Milestone: None
Component: event Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:
Description
$(document).on(".test",function(){console.log("test success")}).off(".test") // Stack Overflow
Attachments (0)
Change History (11)

Changed February 18, 2013 11:32AM UTC by c4605 comment:1

_comment0: http://jsfiddle.net/vTqH3/1361192197538589

Changed February 18, 2013 01:00PM UTC by c4605 comment:2

Changed February 18, 2013 01:55PM UTC by rwaldron comment:3

owner: → rwaldron
status: newassigned

Confirmed.

Changed February 18, 2013 02:52PM UTC by rwaldron comment:4

Changed February 18, 2013 03:25PM UTC by rwaldron comment:5

resolution: → notabug
status: assignedclosed

Sorry, but after further discussion and review, that signature isn't actually supported by jQuery.

Changed February 18, 2013 03:35PM UTC by dmethvin comment:6

component: unfiledevent
priority: undecidedlow

Reopening so we can turn this into a no-op rather than an infinite loop, but the root problem is this line:

.on('.dropdown-menu', function (e) { e.stopPropagation() })

You must specify a type name. The docs say the type name may be qualified by a namespace, but not that the type name is optional. It's only optional when removing events.

Changed February 18, 2013 06:06PM UTC by dmethvin comment:7

resolution: notabug
status: closedreopened

Whoops, meant to reopen.

There is a pull request to fix the Bootstrap problem; see the reference to the bug report there as well.

https://github.com/twitter/bootstrap/pull/6970

Changed February 19, 2013 01:46AM UTC by c4605 comment:8

_comment0: maybe we need throw an error?1361238528661531

maybe we need throw an error when bind this event?

i think many people (for example me) will do like this

Changed February 25, 2013 01:24PM UTC by anonymous comment:9

thnk q very much

Replying to [ticket:13471 c4605]:

> $(document).on(".test",function(){console.log("test success")}).off(".test") // Stack Overflow
> 

Changed February 26, 2013 05:23PM UTC by Dave Methvin comment:10

resolution: → fixed
status: reopenedclosed

Fix #13471. $().on(".xyz"...) should avoid later crash.

If the event type is an empty string we end up hanging in .off() which makes for

mighty hard debugging. Instead treat it as a no-op. Docs seem clear this is not

allowed.

Changeset: 2bbc3d5860b81e128cd92f865673e10046caac7d

Changed February 26, 2013 05:26PM UTC by Dave Methvin comment:11

Fix #13471. $().on(".xyz"...) should avoid later crash.

If the event type is an empty string we end up hanging in .off() which makes for

mighty hard debugging. Instead treat it as a no-op. Docs seem clear this is not

allowed.

Changeset: f5163914fa1a751aa5bf10ce48c4b5307d65ed90