For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > March 2008 > Compiler errors in commented JavaScript code









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Compiler errors in commented JavaScript code
Richard

2008-03-29, 7:28 pm

Hi,

I removed some functionality from an ASP.NET 2 webpage by deleting the input
ior textbox control from the page's code. Then I commented out the JavaScript
function on the same page that referenced the deleted control, so the
commented function looks like this:

/*
function MyFunction()
{
}
*/

I'm puzzled why the compiler gives me an error in a line of code that's
inside the commented function, and references the deleted control. It
complains b/c the control doesn't exist... But the code is commented out! Do
you know why does this happens?

Thanks in advance,

Rick
Just Me

2008-03-29, 7:28 pm


You will probably find that you have missed out a semicolon or brace
somewhere else in the code, this is obviously bogus as an error message in
that respect.


"Richard" <Richard@discussions.microsoft.com> wrote in message
news:229F9EDF-2A55-4EA0-ABA1-C4FA21C7C297@microsoft.com...
> Hi,
>
> I removed some functionality from an ASP.NET 2 webpage by deleting the
> input
> ior textbox control from the page's code. Then I commented out the
> JavaScript
> function on the same page that referenced the deleted control, so the
> commented function looks like this:
>
> /*
> function MyFunction()
> {
> }
> */
>
> I'm puzzled why the compiler gives me an error in a line of code that's
> inside the commented function, and references the deleted control. It
> complains b/c the control doesn't exist... But the code is commented out!
> Do
> you know why does this happens?
>
> Thanks in advance,
>
> Rick



Richard

2008-03-29, 7:28 pm

But the coloring code of Visual Studio shows the function in commented-out
color, then whatever is inside the function should be dismissed by the
compiler.
Also, if some semicolon or brace was missing from other code, how comes
there was no error or warning before commenting the JS function?
I've seen the ASP.NET JS debugger stepping thru commented-out JS code, and I
wonder why? Have anyone else experimented this?

"Just Me" wrote:

>
> You will probably find that you have missed out a semicolon or brace
> somewhere else in the code, this is obviously bogus as an error message in
> that respect.
>
>
> "Richard" <Richard@discussions.microsoft.com> wrote in message
> news:229F9EDF-2A55-4EA0-ABA1-C4FA21C7C297@microsoft.com...
>
>
>

Just Me

2008-03-29, 7:28 pm


I tried. I cant set a break point on the commented code, nor can I
replicated your problem. You may have some corruption in the symbols
datatbase. Delete the debug stuff and rebuild it.



"Richard" <Richard@discussions.microsoft.com> wrote in message
news:17D93DFF-F610-461D-97F5-D2AB0E00AEC7@microsoft.com...[color=darkred]
> But the coloring code of Visual Studio shows the function in commented-out
> color, then whatever is inside the function should be dismissed by the
> compiler.
> Also, if some semicolon or brace was missing from other code, how comes
> there was no error or warning before commenting the JS function?
> I've seen the ASP.NET JS debugger stepping thru commented-out JS code, and
> I
> wonder why? Have anyone else experimented this?
>
> "Just Me" wrote:
>


Ben Amada

2008-03-30, 5:15 am

Richard wrote:

> But the coloring code of Visual Studio shows the function in commented-out
> color, then whatever is inside the function should be dismissed by the
> compiler.
> Also, if some semicolon or brace was missing from other code, how comes
> there was no error or warning before commenting the JS function?
> I've seen the ASP.NET JS debugger stepping thru commented-out JS code, and
> I
> wonder why? Have anyone else experimented this?


I recently saw a problem in VS2005 where a block of HTML was commented out
with the standard <!-- and --> marks. Within the commented out HTML, there
were other HTML comments documenting some of the commented out HTML. In
VS2005, the entire commented out block was green and IE7 was ignoring the
commented out block. However, Firefox was not ignoring some of the
commented out HTML. The W3 validator also appeared to be treating some of
the commented out HTML as though it was not commented out.

To fix the problem, I removed the "embedded" HTML comment marks so in the
end, I only had one beginning comment out mark and one ending comment mark.
This might not be the same problem you're seeing. I just wanted to mention
this because it does seem possible that Visual Studio may show some code as
commented out via its green font, but another program (the JS debugger or
another browser) may not treat the code as commented out.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com