I am creating a browser extension in which i am using jQuery Range2DSlider plugin v1.0.5. Slider is working if installed in Chrome but is not working in firefox. The error message showing in firefox is
Warning: Argument 1 of Node.appendChild does not implement interface Node. Function-name: appAPI.message.addListener User callback
This error occurs when the slider runner is appending to slider box. The code in the Range2DSlider plugin to append the runner is as follows.
// create runners
var $runner;
for(i=0;i<_this.values.length;i++){
if( !_this.$runners[i] ){
_this.$runners.push($runner = $('<div class="xdsoft_range2dslider_runner xdsoft_range2dslider_runner'+i+'"></div>'));
$runner.append($inrunner = $('<input type="button">'));
$runner[0].ranges = [];
$runner.addClass('xdsoft_range2dslider_'+_this.options.runnerClassSkin.xd(i));
!function(i){
$inrunner
.on('focus',function(){
$('.xdsoft_range2dslider_active').removeClass('xdsoft_range2dslider_active');
$(this).parent().addClass('xdsoft_range2dslider_active');
})
.on('keydown',function( event ){
var relX = _this.values[i][0],
relY = _this.values[i][1],
ax = _this.options.allowAxisMove.xd(0,'both');
switch( event.which ){
case ARROWUP:
if( ax=='both'||ax=='y' ){
relY+=_this.options.stepOnKey.xd(1);
}
break;
case ARROWDOWN:
if( ax=='both'||ax=='y' ){
relY-=_this.options.stepOnKey.xd(1);
}
break;
case ARROWRIGHT:
if( ax=='both'||ax=='x' ){
relX+=_this.options.stepOnKey.xd(0);
}
break;
case ARROWLEFT:
if( ax=='both'||ax=='x' ){
relX-=_this.options.stepOnKey.xd(0);
}
break;
default: return true;
}
setValue(_this,i,relX,relY);
event.stopPropagation();
event.preventDefault();
});
}(i);
}else{
for(var t=0;t<_this.$runners[i][0].ranges.length;t++)
_this.$runners[i][0].ranges[t].rect.remove();
_this.$runners[i][0].ranges = [];
}
}
// for second init remove extra sliders
for(i=_this.values.length;i<_this.$runners.length;i++){
_this.$runners[i].remove();
}
_this.$runners.length = _this.values.length;
if( $.isArray(_this.options.showRanges)&&_this.options.showRanges.length&&_this.values.length>1 ){
var range,$range ;
for(i=0;i< _this.options.showRanges.length;i++){
rangeBetween = _this.options.showRanges.xd(i);
if( rangeBetween && $.isArray(rangeBetween) && rangeBetween.length && rangeBetween[0]!=rangeBetween[1] && _this.$runners[rangeBetween[0]] && _this.$runners[rangeBetween[1]] ){
$range = $('<div class="xdsoft_range2dslider_range xdsoft_range2dslider_range'+i+'"></div>');
_this.$runners[rangeBetween[0]][0].ranges.push({rect:$range,rb:rangeBetween});
_this.$runners[rangeBetween[1]][0].ranges.push({rect:$range,rb:rangeBetween});
_this.$sliderBox.append($range);
$range.on('mousedown',function(e){
e.stopPropagation();
});
}
}
}
_this.$sliderBox
.css({
height:_this.options.height,
width:_this.options.width
})
.append(_this.$runners);
Any help would be greatly appreciated. Thanks in advance
Here _this.$runners is a jQuery object. append method accepts only DOM elements. changing the jQuery object to DOM element do the trick.
_this.$sliderBox
.css({
height:_this.options.height,
width:_this.options.width
})
.append(_this.$runners[0]);
This code works now