JSLint reports that anonymous functions such as this: var f = function(args) { // body } would be better like this: var f = function (args) { // body } Why is...
1291
Douglas Crockford
douglascrock...
May 1, 2010 7:23 pm
... It is for readability. It makes it clearer that you are creating a function and not calling a function. Also, you forgot the semicolon....
1292
Cheney, Edward A SSG ...
sandyhead25
May 2, 2010 9:56 pm
That is not an anonymous function. The follow two are identical. var f = function () { // body }; function f () { // body } In both cases you are assigning a...
1293
Michael Lorton
mlorton
May 2, 2010 10:08 pm
Identical? Have you ever heard the expression "not always right, but never in doubt"? What should the following show? var f = function () { }; function g() { ...
1294
Marcel Duran
marcelduran
May 3, 2010 12:33 am
On Sun, May 2, 2010 at 2:56 PM, Cheney, Edward A SSG RES USAR USARC < ... expression. Consider the following: f(); function f () {} This works because function...
1295
Rob Richardson
erobrich
May 3, 2010 4:06 pm
I've typically used the keyword 'function39; to denote that I'm creating a function. In quick testing, I find no way to call a function with the keyword...
1296
Noah Sussman
thefangmonster
May 3, 2010 4:42 pm
... (function (foo) { return foo; })('bar39;); -- Noah Sussman Software Historian @noahsussman A foolish consistency is the hobgoblin of little minds    ...
1297
Rob Richardson
erobrich
May 3, 2010 10:42 pm
You're creating it with 'function39; then invoking it right away. Is there a similar way to use the keyword 'function39; to call a previously defined function?...
1298
Cheney, Edward A SSG ...
sandyhead25
May 4, 2010 4:23 am
Michael, Your example is partially accurate, but consider the following: var f = function () {}; function g () {} if (typeof(f) === typeof(g)) { ...
1299
Michael Mikowski
z_mikowski
May 10, 2010 3:31 pm
$0.02: First, "the good parts" advocates the following form, as it illustrates the true nature of functions: 1. var fnOnClick = function (){ ... }; Others...
1300
adam.kumpf
May 10, 2010 3:47 pm
As a developer, I use the console.log() function (or ADSAFE.log() internal to an adsafe widget) frequently to debug my code. I've noticed that when there is an...
1301
adam.kumpf
May 10, 2010 4:19 pm
Since ADSafe widgets are basically sandboxed javascript/dom apps, is there any suggestion on how to nicely shut them down (such as an ADSAFE.stop() function)? ...
1302
Douglas Crockford
douglascrock...
May 10, 2010 6:17 pm
... You can call the widget's .remove() method....
1303
Douglas Crockford
douglascrock...
May 10, 2010 6:21 pm
... Please let me see your suggestions....
1304
adam.kumpf
May 10, 2010 6:42 pm
... Hi Doug, I added the ADSAFE.log() call to all three try/catch blocks. The most notable of which was when calling the supplied function: try { f(dom,...
1305
adam.kumpf
May 10, 2010 6:58 pm
Is it possible to manipulate and draw on a <canvas> element from within an ADSAFE widget? I can select the canvas element, and it exists in the protected...
1306
Douglas Crockford
douglascrock...
May 10, 2010 8:28 pm
... You can use the new getContext method. ADsafe is discussed at http://tech.groups.yahoo.com/group/caplet/...
1307
avegaart
May 11, 2010 6:18 am
I just ran the ExtJS javascript library through JSLint again and I am pleasantly surprised by the progress that JSLint has made in the past few months. The...
1308
Cheney, Edward A SSG ...
sandyhead25
May 11, 2010 11:19 am
Try these: Example 1: var a = (0.5 * 2); Example 2: var x, y; if (x === 1 && y === 1) { //do this } Do not perform assignment in a condition. That should...
1309
avegaart
May 11, 2010 11:54 am
Thanks for the reply. I know I can fix issues 1 and 2, but my question was why the parser stops when it should continue with a warning. ps. Your solution to...
1310
Douglas Crockford
douglascrock...
May 11, 2010 1:27 pm
... 1. Fix your code, then it won't stop. 2. Fix your code, then it won't stop. 3. b was used before it was declared. This can confuse a reader, who will...
1311
Cheney, Edward A SSG ...
sandyhead25
May 11, 2010 4:45 pm
... You are still performing assignment in a condition and not evaluation. At the same time never use redundant assignment, such as x = y = 1, because that is...
1312
Rob Richardson
erobrich
May 11, 2010 5:04 pm
Is there a good rule-of-thumb for what type of errors stop JSLint immediately and what type of errors accumulate? Rob ________________________________ From:...
1313
Cheney, Edward A SSG ...
sandyhead25
May 12, 2010 4:25 am
Rob, Evaluation of the code, JSLint function, will tell you exactly that. It is not likely that there are static definitions that point certain errors to...
1314
Arthur Blake
blakesys
May 17, 2010 3:32 pm
With the following input, /** * A comment *//A redundant comment */ JSLint reports: Problem at line 3 character 4: Unclosed regular expression. I think this is...
1315
Arthur Blake
blakesys
May 17, 2010 3:33 pm
Actually, I see the problem now. My fault. */ terminates the first comment early .. Oops. ... [Non-text portions of this message have been removed]...
1316
santini.alberto
May 17, 2010 3:38 pm
I pasted the following snippet in jslint.com text area, selected "The Good Parts" options and pressed "JSLint" button:function foo(p1) { var a = p1, b; return...
1317
santini.alberto
May 18, 2010 10:39 am
The snippet: function foo(p1) { var a = p1, b; return a; } Regards, Alberto...
1318
santini.alberto
May 19, 2010 10:44 am
It seems there is a difference if I use, for instance, FireFox (3.6.3) on Windows XP: the web version catches correctly the two errors. In my first post I used...
1319
Douglas Crockford
douglascrock...
May 19, 2010 1:25 pm
... It would seem that there is a bug in Rhino....