Search and Top Navigation
#8385 closed bug (fixed)
Opened June 06, 2012 05:26PM UTC
Closed June 14, 2012 04:33PM UTC
Last modified August 01, 2012 06:04PM UTC
Widget: _bind() on elements such as document are dangerous
Reported by: | scottgonzalez | Owned by: | |
---|---|---|---|
Priority: | blocker | Milestone: | git |
Component: | ui.widget | Version: | git (not yet released) |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
If all instances of a widget are binding to a common element, such as document
, then when one instance of destroyed all event handlers will be unbound. This is problematic and needs to be addressed somehow.
Attachments (0)
Change History (8)
Changed June 06, 2012 05:26PM UTC by comment:1
priority: | minor → blocker |
---|---|
status: | new → open |
Changed June 06, 2012 05:36PM UTC by comment:2
One thought is that we can just be aware of the problem and avoid doing this. It's not specific to _bind()
anyway. We'd need to have a single event handler that manages all instances. We could potentially make this easier by having the widget factory automatically track all instances. This shouldn't be too bad in terms of memory since it's just an array of pointers. For example, right now we're tracking all droppable instances in the interactions rewrite. We could just automatically track this in $.ui.droppable.instances
.
Changed June 06, 2012 05:53PM UTC by comment:3
Suggestion from gnarf: Create a uuid for all instances and use the uuid in the namespace inside _bind().
Changed June 07, 2012 10:35AM UTC by comment:4
Adding a uuid to the namespace is also what Backbone's delegateEvents method does: http://documentcloud.github.com/backbone/docs/backbone.html#section-156
Note eventName += '.delegateEvents' + this.cid;
Changed June 10, 2012 03:23PM UTC by comment:5
Here's a test: https://gist.github.com/7325217f7f3c78f45457
Changed June 10, 2012 06:58PM UTC by comment:6
Changed June 14, 2012 04:33PM UTC by comment:7
resolution: | → fixed |
---|---|
status: | open → closed |
Generate a uuid for each widget for unique namespaces. Fixes #8385 - Widget: _bind() on elements such as document are dangerous
Changeset: 28b14ec47cfeb3c58e44f35170cdd8a9270aceae
Changed August 01, 2012 06:04PM UTC by comment:8
milestone: | 1.9.0 → git |
---|