View Full Version : [FIXED] Syntax warning/errors not provided full scope when used in a function
17 Apr 2012, 5:42 PM
in the code pictured, it is complaining that record is already defined. Is record not local scoped to this function? Maybe I'm wrong. would be nice to know.
17 Apr 2012, 11:15 PM
record is 2nd param in your function so you are essentially redeclaring it
17 Apr 2012, 11:30 PM
The code that you posted above is "incorrect". record will come in as an argument and you do not have to redefine it with a var.
That being said, it's more a warning than anything else coming from JSHint. As best practice, you should remove the var in front of any variables that come in as arguments.
21 Apr 2012, 8:23 AM
Aaron, I'm not sure from your answer if that means it's OK the warning does not show up in the individual script editor but does in the full view of the source (or not OK). The top of this thread is marked as not reproducable. I'm assuming it's not reproducable for you guys because it does seem like it should complain if I "var" a variable that comes in from a function parameter (thruthfully, I did not notice that because mostly because the parameters are kind of small in the editor window, but I can get use to that, while on that topic, I hate referencing a variable by the name "abstractcomponent" in my code. seems like an oxymoron to reference somthing with the name abstract component.
At anyrate, I'm going to email you my project that demonstrates this script error not being reported in the OnGridPanelusersIdItemclick event but does show the error in the bigger view of source (see pictures here also). If you are good with it working the way it is, just ignore my email (like I have to say that).
Thanks for all your support! SA is looking great and is a big help on my current project. +1111111111
24 Apr 2012, 3:34 PM
Peter - You should be getting a warning/error in the individual function. This is a bug on our end due to the editor not understanding that you are currently within a function.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.