Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#899 closed defect (fixed)

Some improvements in the Javascript

Reported by: jcm Owned by: akaEdge
Priority: normal Milestone:
Component: Documentation Version: trunk
Severity: normal Keywords:
Cc:

Description

I passed Xinha's code in JsLint? (http://www.jslint.com)

Here are the most important changes:

return range.htmlText
(missing ; at the end)

var m = txtNode.data.match(HTMLArea.RE_url);
(m is redefined, please remove var before m)

else if(data != null)
(use '!==' to compare with 'null')

if (typeof string == 'string') var m = string.match(/\$(.*?)=(.*?)\$/g);
(remove the declaration outside the if:
var m;
if (typeof string == 'string') m = string.match(/\$(.*?)=(.*?)\$/g);
)


for ( var i in replace )
(identifier 'i' already declared as var*)

JC

Change History (2)

comment:1 Changed 11 years ago by ray

  • Resolution set to fixed
  • Status changed from new to closed
return range.htmlText
(missing ; at the end)

OK

var m = txtNode.data.match(HTMLArea.RE_url);
(m is redefined, please remove var before m)

OK

else if(data != null)
(use '!==' to compare with 'null')

A skipped argument is NOT !== null
I change this instead to

else if(typeof data == "object")
if (typeof string == 'string') var m = string.match(/\$(.*?)=(.*?)\$/g);
(remove the declaration outside the if:
var m;
if (typeof string == 'string') m = string.match(/\$(.*?)=(.*?)\$/g);
) 

OK

for ( var i in replace )
(identifier 'i' already declared as var*)

I leave this as it is because the first declaration is in a different context and IMHO this doesn't hurt much

committed rev [629]

Thank you for taking the time to check this. Actually I had thought JSlint would find more "problems" :)

comment:2 Changed 11 years ago by mokhet

Duplicate entry from ticket #385

I think #385 should be be closed too, but since I'm over busy actually, I let you Ray (or others of course) make the decision on the fate of #385 :D

Note: See TracTickets for help on using tickets.