[TYPO3-core] RFC: #10377: Some errors in typo3/js-scripts causes some trouble

Steffen Kamper info at sk-typo3.de
Sat Feb 7 22:43:12 CET 2009


Hi Masi,

Martin Kutschker schrieb:
> Steffen Kamper schrieb:
>> This is SVN patch request.
>>
>> Type: Bugfix
>>
>> Branches: trunk, 4_2
>>
>> BT reference: http://bugs.typo3.org/view.php?id=10377
>>
>> I investigated the scripts in typo3/js with JSlint and found some
>> problems which i solved.
>>
>> As positive side effect the backendsearch-box now has a visible cursor.
>>
>> I changed these issues:
>> * added missing semicolons
> 
> They are optional in JS, but I think it's good practice always to add them.
>

it seems that this caused the unvisible cursor in bachend searchbox, but 
not sure.

>> * used === and !== with compare of integer and string
> 
> Ok.
> 
>> * added radix for parseInt
> 
> I don't see this in the patch. What's the purpose of this anway?
> 

i have to look again. There is a second param for parseInt which is the 
radix(2 for dual, 8 for octal, 10 for decimal etc.) JSlint want this 
param to be added. It doesn't hurt, and if it cause better JS 
performance, i'm for it.

There was one call i changed
>> * changed a = new Array(); to a = [];
>> * changed a = new Object(); to a = {};
> 
> Why? Is this required by our JS CGL?
>

JSlint suggests "Use the array literal notation ". The used syntax now 
is like in php if you say
$a = array();
small, clean and the usual way in JS scripts.

>> * some vars where prefixed with var where they was defined before
> 
> I hope  you made none global by accident.
> 

no, it was in this syntax:

function(event) {
    if(!event) {
	var event = window.event;
    }
};

you see that event was used as function parameter, so need here for 
keyword var.

vg Steffen


More information about the TYPO3-team-core mailing list