Skip to main content

Search and Top Navigation

#4910 closed bug (worksforme)

Opened October 14, 2009 10:44AM UTC

Closed October 14, 2009 01:06PM UTC

Last modified October 11, 2012 09:15PM UTC

greedy property doesn't work when using .bind syntax

Reported by: iceberg901 Owned by:
Priority: major Milestone:
Component: ui.droppable Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:
Description

Let's say I have a DIV inside of a DIV and both are droppable. I set the child DIV's droppable's greedy property to true, so that if something is dropped successfully on the child DIV, the parent DIV's drop handler will not fire. If I attach the parent DIV's drop handler using the drop property when calling .droppable() on the parent DIV, this works. If I attach the parent DIV's drop handler using .bind('drop') syntax, it does not work. The parent's drop handler still fires when a drop is made on the child.

Attached is a modification of the standard propagation.html sample that shows the bug. I set up the drop handler on the greedy container using .bind syntax instead of the drop callback member, and the sample no longer functions as it should when you drop on the greedy Inner droppable.

Attachments (1)
Change History (3)

Changed October 14, 2009 01:06PM UTC by scottgonzalez comment:1

resolution: → worksforme
status: newclosed

Events are supposed to propagate; that's one of the main reasons to use events. Check the event target to figure out which element is being activated.

Changed October 15, 2009 08:33AM UTC by iceberg901 comment:2

Replying to [comment:1 scott.gonzalez]:

Events are supposed to propagate; that's one of the main reasons to use events. Check the event target to figure out which element is being activated.

In that case, I take issue with the documentation, as it states about the greedy property: "If true, will prevent event propagation on nested droppables" - Yes, events are supposed to propagate, but not if you set greedy = true, according to the documentation. You can obviously handle the event yourself and do event.stopPropagation, but the documentation claims that you can do the same by setting greedy = false; a handy shortcut, if you will. It makes do distinction as to whether you use the drop callback or the .bind syntax with the greedy property, and in fact explicitly mentions EVENT propagation.

And the purpose for using the .bind syntax is not necessarily only to use an event instead of a callback for propagation purposes. It may just be to be able to bind an arbitrary number of listeners without having to keep track of them and iterate through them in a callback function.

So in that case, is this the place to make suggestions/comments about the documentation or is there someplace else to do that?

Changed October 11, 2012 09:15PM UTC by scottgonzalez comment:3

milestone: TBD

Milestone TBD deleted