js/lists/checkboxlist/checkboxlist.js in rsence-pre-2.3.0.1 vs js/lists/checkboxlist/checkboxlist.js in rsence-pre-2.3.0.2
- old
+ new
@@ -58,11 +58,11 @@
* = Parameters
* +_listValue+:: listValue to add.
*
**/
addItem: function( _listValue ){
- if(this.value.indexOf(_listValue) === -1){
+ if(!~this.value.indexOf(_listValue)){
var _newValue = [], i = 0;
for( ; i < this.value.length; i++ ){
_newValue.push( this.value[i] );
}
_newValue.push( _listValue );
@@ -78,11 +78,11 @@
* +_listValue+:: A listValue to delete.
*
**/
delItem: function( _listValue ){
var _listIndex = this.value.indexOf(_listValue);
- if(_listIndex !== -1){
+ if(~_listIndex){
var _newValue = [], i = 0;
for( ; i < this.value.length; i++ ){
if(this.value[i] !== _listValue){
_newValue.push( this.value[i] );
}
@@ -123,11 +123,11 @@
this.listItemViews = [];
for ( i = 0 ; i < _listItems.length; i++ ){
_listItem = _listItems[i];
_value = _listItem[0];
_label = _listItem[1];
- _checked = (this.value.indexOf( _value ) !== -1);
+ _checked = !!~this.value.indexOf( _value );
_checkbox = this.ListCheckbox.nu(
[ 4, (i*23)+4, null, 23, 4, null ],
this, {
label: _label,
value: _checked,
@@ -178,10 +178,10 @@
_selectedItems = [],
i = 0,
_isSelected;
for( ; i < _listItems.length; i++ ){
_listItemValue = _listItems[i][0];
- _isSelected = (_value.indexOf( _listItemValue ) !== -1);
+ _isSelected = !!~_value.indexOf( _listItemValue );
this.listItemViews[i].setValue( _isSelected );
if(_isSelected){
_selectedItems.push( _listItemValue );
}
}
\ No newline at end of file