Closed (fixed)
Project:
Views Simple Spy
Version:
6.x-1.1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
10 Sep 2010 at 22:41 UTC
Updated:
13 Apr 2012 at 21:01 UTC
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
Comment #1
hyperlinkedI found the problem and it kills two birds with one stone.
On line 31:
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.
Comment #2
dellintosh commentedFixed in version 1.1