Opened 12 years ago

Closed 10 years ago

#6050 closed bug (invalid)

Additional null check on _drop

Reported by: JonKragh Owned by: JonKragh
Priority: minor Milestone: 2.0.0
Component: ui.droppable Version: 1.8
Keywords: Cc:
Blocked by: Blocking:

Description (last modified by mikesherov)


I have an app where droppable items are added dynamically via ajax. My droppable item's html is returned from the server, and then I register them as droppable via jQuery UI once they are added to the DOM.

Sometimes when these items are dropped in Firefox 3.6.9 (especially when dragging upwards and then dropping I get: "inst is null" on line 1736. (the code is in "ui.droppable")

I'm using jQuery UI 1.8, but I tried 1.8.4 and had the same issue.

I added the following check for null "inst!=null &&", under the comment " jhk".

Once I added this, all is well, and drop is working properly.

_drop: function(event,custom) {

		var draggable = custom || $.ui.ddmanager.current;
		if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
		var childrenIntersection = false;
		this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
			var inst = $.data(this, 'droppable');
                // jhk - added "inst!=null &&"
                inst!=null &&
				&& !inst.options.disabled
				&& inst.options.scope == draggable.options.scope
				&&[0], (draggable.currentItem || draggable.element))
				&& $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)
			) { childrenIntersection = true; return false; }

I have not tried other browsers.

Thanks, Jon

Change History (6)

comment:1 Changed 12 years ago by JonKragh

The "inst!=null &&" is supposed to be on it's own line, not commented out. The formatting got messed up when posting the bug.

comment:2 Changed 12 years ago by Scott González

Component: ui.coreui.droppable

comment:3 Changed 10 years ago by Scott González

Milestone: TBD2.0.0

comment:4 Changed 10 years ago by mikesherov

Description: modified (diff)

comment:5 Changed 10 years ago by mikesherov

Owner: set to JonKragh
Status: newpending

Thanks for taking the time to contribute to the jQuery UI project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.

Additionally, be sure to test against the git version of both jQuery UI and jQuery to ensure the issue still exists. To get you started, use this boilerplate: Open the link and click to "Fork" (in the top menu) to get started.

comment:6 Changed 10 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Note: See TracTickets for help on using tickets.