#4910 closed bug (worksforme)
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 (4)
Changed 13 years ago by
Attachment: | propagation_showgreedybug.html added |
---|
comment:1 follow-up: 2 Changed 13 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
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.
comment:2 Changed 13 years ago by
Replying to 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?
modification of propagation.html demo showing the bug