Compiler errors in commented JavaScript code
Compiler errors in commented JavaScript code
am 29.03.2008 18:07:02 von 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
Re: Compiler errors in commented JavaScript code
am 29.03.2008 18:33:29 von unknown
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" 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
Re: Compiler errors in commented JavaScript code
am 29.03.2008 20:32:00 von 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?
"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" 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
>
>
>
Re: Compiler errors in commented JavaScript code
am 29.03.2008 21:39:12 von unknown
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" wrote in message
news:17D93DFF-F610-461D-97F5-D2AB0E00AEC7@microsoft.com...
> 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" 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
>>
>>
>>
Re: Compiler errors in commented JavaScript code
am 30.03.2008 07:43:46 von Ben Amada
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 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.