[TYPO3-core] RFC: de-highlighting page in page tree in non-life workspaces

Ernesto Baschny [cron IT] ernst at cron-it.de
Sat Feb 24 11:30:14 CET 2007


Oliver Hader wrote: on 24.02.2007 11:13:

>> The JS-code which removes the classes from the previous page is wrong,
>> as removeClassName seem to expect a single class and it is passed the
>> space separated list of classes. So we just need to iterate through the
>> list of classes and remove each one of it. Attached patch should do that.
> 
> This is reasonable and works, so generally +1
> 
>> +		if (obj) {
>> +			var classes = this.highlightClass.split(' ');
>> +			for (var i = 0; i < classes.length; i++)
>> +				Element.removeClassName(obj, classes[i]);
>> +		}
> 
> You could use the following code instead:
> 
> if (obj) {
> 	var i, length, classes = $w(this.highlightClass);
> 	for (i = 0, length = classes.length; i < length; i++) {
> 		Element.removeClassName(obj, classes[i]);
> 	}
> }
> 
> The $w(...) function of prototype does the whitespace split by "\s+" and
> removes leading and trailing whitespaces.

Thanks for the hint, will do it this way. I have never really dug into
the possibilities in prototype, but will probably do so soon.

Cheers,
Ernesto


More information about the TYPO3-team-core mailing list