If the view definition returns only one or two nodes to display in SimpleSpy, the output will not rotate. Instead, a JavaScript error will be thrown and the rotation will be stuck on the first shown node output.

The error message you get is:
Node cannot be inserted at the specified point in the hierarchy" code: "3
this.insertBefore( elem, this.firstChild );

The error traces back to line 55 of the views-simplespy.js file at the end of the following code block

					function spy() {
						// insert new item with opacity and height of zero
						var $insert = $(items[currentItem]).css({
							height : 0,
							opacity : 0,
							display : 'none'
						}).prependTo($list);

It apparently doesn't like to .prependTo $list objects that are shorter than 3 items.

Editing your views filter so that more than two items are returned will resolve the issue.

Comments

hyperlinked’s picture

I found the problem and it kills two birds with one stone.

On line 31:

29	var $list = $(this),
30	items = [], // uninitialised
31	currentItem = parseInt(limit) + 1,
32	total = 0, // initialise later on
33	height = $list.find('> li:first').height();

Take out the + 1

The other issue that gets fixed with this adjustment is another bug that causes the final item in a SimpleSpy view to be bypassed. The extra count that's added causes the loop to reset back to the beginning prematurely and the last item is always bypassed.

dellintosh’s picture

Version: 6.x-1.0 » 6.x-1.1
Status: Active » Fixed

Fixed in version 1.1

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.