Search and Top Navigation
#6050 closed bug (invalid)
Opened September 14, 2010 01:49PM UTC
Closed November 12, 2012 09:10AM UTC
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
Hi,
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'); if( // jhk - added "inst!=null &&" inst!=null && inst.options.greedy && !inst.options.disabled && inst.options.scope == draggable.options.scope && inst.accept.call(inst.element[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
Attachments (0)
Change History (6)
Changed September 14, 2010 01:52PM UTC by comment:1
Changed September 14, 2010 03:05PM UTC by comment:2
component: | ui.core → ui.droppable |
---|
Changed October 11, 2012 09:07PM UTC by comment:3
milestone: | TBD → 2.0.0 |
---|
Changed October 29, 2012 04:17AM UTC by comment:4
description: | Hi, \ \ 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 a "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'); \ if( \ // jhk - added "inst!=null &&" \ inst!=null && \ inst.options.greedy \ && !inst.options.disabled \ && inst.options.scope == draggable.options.scope \ && inst.accept.call(inst.element[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 \ → Hi, \ \ 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'); \ if( \ // jhk - added "inst!=null &&" \ inst!=null && \ inst.options.greedy \ && !inst.options.disabled \ && inst.options.scope == draggable.options.scope \ && inst.accept.call(inst.element[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 \ |
---|
Changed October 29, 2012 04:18AM UTC by comment:5
owner: | → JonKragh |
---|---|
status: | new → pending |
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: http://jsfiddle.net/ZgAqH/ Open the link and click to "Fork" (in the top menu) to get started.
Changed November 12, 2012 09:10AM UTC by comment:6
resolution: | → invalid |
---|---|
status: | pending → closed |
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!
The "inst!=null &&" is supposed to be on it's own line, not commented out. The formatting got messed up when posting the bug.