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

Oliver Hader oh at inpublica.de
Sat Feb 24 11:13:51 CET 2007


Ernesto Baschny [cron IT] wrote:
> Solution:
> 
> 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.


olly
-- 
Oliver Hader
http://inpublica.de/


More information about the TYPO3-team-core mailing list