Compiler errors in commented JavaScript code

R

Richard

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
 
J

Just Me

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.
 
R

Richard

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?
 
J

Just Me

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.
 
B

Ben Amada

Richard said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top