Placing breakpoints should work just fine, even with the Class.create()
syntax... I do it all the time in VS.NET Full and also in VWD Express.
To help you further, I''d have to see an example of some of your code,
and
maybe how you include the js into your pages/controls...
As for anonymous functions, yes that''s an issue. Let''s say you
have the
following line of code:
Event.observe(''someElement'', ''click'',
function()
{
doSomething1();
doSomething2();
});
Placing a breakpoint anywhere within that line of code (even if you add the
carriage returns to the anonymous function, I''m sure you can see
it''s only 1
line), results in the code breaking at the point Event.observe() is called,
which does nothing more than attach the anonymous function as a click
handler to someElement.
The easiest way to overcome this, and this technique can be applied to
anonymous delegates in server side code as well (C#, Java, etc...)... is to
make a call to a known static method from within the anonymous method. For
example''s sake, let''s say that is a function at the global
level called
"AnonymousDebug". That function can be empty, it only exists as an
anchor
for stepping into anonymous (and even server generated) code.
function AnonymousDebug()
{
// place breakpoint here on this line
}
So now when you isolate a potential problem down to a piece of anonymous
code and you need to step into it, add the call to AnonymousDebug as the
first line of the anonymous method:
Event.observe(''someElement'', ''click'',
function()
{
AnonymousDebug();
doSomething1();
doSomething2();
});
When the code breaks inside the anchor function, you will now be able to
step into the rest of the anonymous code.
On 2/15/07, Dave Crane
<dave-qrf20pp95eSLQvtTh0HkdajZmZ73YKuj@public.gmane.org>
wrote:>
>
> Hi Grant,
>
> I don''t use VS studio, but I do use the MS Script Editor (as
opposed to
> the
> freebie Script Debugger, which I''ve found to be unreliable), which
is the
> same thing that you''ll see inside VS Studio, I think. (Confession
time: I
> have FrontPage installed on my laptop, just for the script debugger -
I''ve
> removed the shortcuts from the start menu long ago.)
>
> The script debugger doesn''t cope very well with anonymous
functions, and
> the
> prototype house style very much favours these, as does my own coding
> style,
> and several other modern JS frameworks,... oh well. The best workaround
> I''ve
> come across when working with anonymous functions is to use the debugger
> keyword in my code to halt it inside the function, e.g.
>
> function blah(x,y,z){
> $(''node'').onclick=function(){
> alert(x);
> alert(y);
> debugger;
> alert(z);
> }
> }
>
> In general, though, I try to make sure anything I''m doing works in
Firefox
> too, even if it''s intended for an IE-only audience, and debug all
the
> general
> issues in Firebug and then switch over to IE to catch the last 10% of
> IE-specific stuff.
>
> Dave
>
> On Thursday 15 February 2007 21:31, Grant wrote:
> > Can somebody please assist me in figuring out what issues exist with
> > the Prototype 1.5 framework and the debugging features in VS 2005?
> > Currently, I seem to be unable to set breakpoints in my .js files
> > (potentially because of the Class.create() pattern for defining
> > classes). Additionally, if the debugger is indeed started because of
> > a Javascript error, then my debugging efforts become tough with array
> > objects because of the number of additional functions/properties added
> > to the Array object, and the "entries" are never sorted in
the "Quick
> > Watch" window in VS 2005.
> >
> > Is there a workaround that could be achieved, at least to achieve
> > proper sort order of array items in the VS 2005 debugger? Thanks
> > much!
> >
> >
> > >
> >
> > --
> > This email has been verified as Virus free
> > Virus Protection and more available at http://www.plus.net
>
> --
> ----------------------
> Author
> Ajax in Action http://manning.com/crane
> Ajax in Practice http://manning.com/crane2
> Prototype & Scriptaculous Quickly http://manning.com/crane3
>
> >
>
--
Ryan Gahl
Application Development Consultant
Athena Group, Inc.
Inquire: 1-920-955-1457
Blog: http://www.someElement.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---