as the following code, my question is:
in testFunction, how can i call function remove?
in remove how can i call testFunction?
in remove, how can i call add?
great thanks
var stringhelper={
testFunction:function(){},
//deal with text such as:
//"alignleft red bold header2"
classValue:{
//test whether classValue has className in it
has:function(classValue,className){
var regex=new RegExp("(^|\\s+)"+className+"(\\s+|$)");
return regex.test(classValue);
},
remove:function(classValue,className){
return classValue.replace(className,"").replace(/\s+/g," ").replace(/^\s+|\s+$/g,"");
},
add:function(classValue,className){
if(/^\s+$/.test(classValue)){
return className;
}
if(!this.has(classValue,className)){
return classValue+" "+className;
}
}
}
};