Skip to main content

Search and Top Navigation

#4904 closed bug (worksforme)

Opened October 09, 2009 04:54PM UTC

Closed March 07, 2013 02:56AM UTC

Last modified March 10, 2014 06:17PM UTC

Sortable: Error "this.helper.0 is null or not an object" when dropping object

Reported by: rgurganus Owned by:
Priority: major Milestone: 2.0.0
Component: ui.sortable Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:
Description

In IE6 and IE7: When dragging and dropping a sortable, IE sometimes returns this error: "this.helper.0 is null or not an object" Looking at the debugger, it is in jquery-ui.js on this line:

if(this.helper[0] == this.currentItem[0]) {

I was able to see this same error on the live demo here, though I can't say what sequence of dragging and dropping led to the error happening.

http://jqueryui.com/demos/draggable/#sortable

In my application, it happens with every drag & drop. I can post code if needed, but if it's happening on yours, maybe you don't need my code.

Same results in both 1.7.2 and 1.8a1

Attachments (0)
Change History (12)

Changed November 16, 2009 09:36AM UTC by jzaefferer comment:1

component: ui.coreui.sortable
milestone: TBD1.8

Changed July 18, 2010 08:13PM UTC by karlgoldstein comment:2

I am experiencing the same error with 1.8.2. Looking at the _clear function of jquery.ui.sortable.js, I see this on line 1030:

if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null;

and am wondering whether there it should be:

if(this.helper[0] != this.currentItem[0]) { this.helper.remove(); this.helper = null; }

otherwise the helper is unexpectedly getting set to null?

Changed May 14, 2011 02:10PM UTC by scottgonzalez comment:3

#7372 is a duplicate of this ticket.

Changed October 08, 2012 05:21PM UTC by earachefl comment:4

I'm having the same error in jquery-ui-1.8.24.custom.js (all modules). Changing line 4343 from:

this.placeholder[0].parentNode.removeChild(this.placeholder[0]);

to:

if(this.placeholder[0].parentNode){this.placeholder[0].parentNode.removeChild(this.placeholder[0]);}

and line 4345 from:

if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null;

to:

if (this.helper && this.helper[0] != this.currentItem[0]) {this.helper.remove();this.helper = null;}

gets rid of the IE8 javascript error message, but as I haven't dug very deeply into the code, I don't know whether there might be any unintended consequences.

Changed October 11, 2012 02:54PM UTC by scottgonzalez comment:5

milestone: 1.9.02.0.0

Changed October 25, 2012 01:38AM UTC by petersendidit comment:6

#6954 is a duplicate of this ticket.

Changed October 25, 2012 01:39AM UTC by petersendidit comment:7

status: newopen
summary: Error "this.helper.0 is null or not an object" when dropping objectSortable: Error "this.helper.0 is null or not an object" when dropping object

Changed March 07, 2013 02:56AM UTC by tj.vantoll comment:8

resolution: → worksforme
status: openclosed

I cannot recreate this issue. This demo specified shows no issues in IE 7 - 9 on http://jqueryui.com. Duplicate #7372 relies on a JS error for a bug to occur, and #6954 is a separate issue.

If anybody watching this is still experiencing this issue please create a reduced test case that shows this. You can use this as a starting point http://jsfiddle.net/tj_vantoll/wjxe4/.

Changed March 07, 2014 07:04PM UTC by briansol comment:9

_comment0: In ie8, I'm getting this bug when using the beforeStop event on linked lists with 1 being a source pool to drag onto other linked sortable lists. (Prevents putting it back into the pool). \ \ \ {{{ \ 'this.helper.0' is null or not an object jquery-ui-1.10.3.custom.min.js, line 6 character 88042 \ }}} \ \ Chrome also throws a different error when using the above linked fiddle, modded to do the same thing: \ \ {{{ \ Uncaught TypeError: Cannot call method 'removeChild' of null jquery-ui-git.js:4986 \ $.widget._clear jquery-ui-git.js:4986 \ (anonymous function) jquery-ui-git.js:392 \ $.widget._mouseStop jquery-ui-git.js:4181 \ (anonymous function) jquery-ui-git.js:392 \ $.widget._mouseUp jquery-ui-git.js:980 \ (anonymous function) jquery-ui-git.js:392 \ _mouseUpDelegate jquery-ui-git.js:931 \ jQuery.event.dispatch jquery-git.js:4628 \ elemData.handle \ }}} \ \ \ sample fiddle forked from above given: \ http://jsfiddle.net/briansol/wjxe4/49/1394219228350932

In ie8, I'm getting this bug when using the beforeStop event on linked lists with 1 being a source pool to drag onto other linked sortable lists. (Prevents putting it back into the pool).

  'this.helper.0' is null or not an object  jquery-ui-1.10.3.custom.min.js, line 6 character 88042

Chrome also throws a different error when using the above linked fiddle, modded to do the same thing:

Uncaught TypeError: Cannot call method 'removeChild' of null jquery-ui-git.js:4986
$.widget._clear jquery-ui-git.js:4986
(anonymous function) jquery-ui-git.js:392
$.widget._mouseStop jquery-ui-git.js:4181
(anonymous function) jquery-ui-git.js:392
$.widget._mouseUp jquery-ui-git.js:980
(anonymous function) jquery-ui-git.js:392
_mouseUpDelegate jquery-ui-git.js:931
jQuery.event.dispatch jquery-git.js:4628
elemData.handle

sample fiddle forked from above given:

http://jsfiddle.net/briansol/wjxe4/50/

Changed March 10, 2014 02:16PM UTC by tj.vantoll comment:10

The docs state to use

cancel()
in a
stop
event rather than a
beforeStop
one, and when I do that this example works fine in Chrome and IE8: http://jsfiddle.net/tj_vantoll/P4aVc/.

Changed March 10, 2014 04:30PM UTC by briansol comment:11

Thanks for that, it does seem to do the trick. I can't seem to find the documentation that says that, though. Can you provide a link to that? Appreciate it.

Changed March 10, 2014 06:17PM UTC by tj.vantoll comment:12

Replying to [comment:11 briansol]:

Thanks for that, it does seem to do the trick. I can't seem to find the documentation that says that, though. Can you provide a link to that? Appreciate it.

http://api.jqueryui.com/sortable/#method-cancel ("Useful in the stop and receive callback functions.")

And no problem.