Search the web
Sign In
New User? Sign Up
ydn-javascript · Yahoo! User Interface Library Group
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Exception in connection-debug.js, it's inside a try/catch but...sho   Message List  
Reply | Forward Message #20157 of 52127 |
Hello all,

I just found YUI and Ext-Js and read they could be mixed together if you use a YUI "adapter".  So after following the basic instructions of library ordering, I set about on a fairly naive quest to embed a YUI drag and drop demo into a window of Ext-Js's Web Desktop .

Amazingly what I did worked.  I simply took the global variables (slots, players, Event, DDM) and made them members of the created window object.  I then substituted the HTML of the drag and drop space "<div id="workarea">..blahblah...</div>" for the "<p>something useful would be in here</p>" that was in the default for blank windows in the ext-js sample.  Suddenly I could drag and drop constrained squares inside a window alongside the ExtJs "Grid Window" and "Accordion Window"!  I was shocked.

But I use Firebug with the "Break on all Errors" option.  And clicking in the ExtJs grid window now causes me to temporarily halt in YUI's connection-debug.js on line 240.  It's a little snip of code in _hasSubmitListener enclosed within a try/catch block, like so:

237 try
239 var obj = YAHOO.util.Event.getTarget(e);
240 if(obj.type.toLowerCase() == 'submit'){
241 YAHOO.util.Connect._submitElementValue = encodeURIComponent(obj.name) + "=" + encodeURIComponent(obj.value);
244 catch(e){}

What's happening is that obj is div.x-grid3-cell-inner, and its .type is undefined.  Of course if I just ignore this, the program runs along smoothly because the error is "caught" by the try/catch block.  But if type being undefined is one of the conditions that one is to expect and is normal, I'd rather it be handled explicitly so it didn't get Firebug to break on it as an error:

if (obj.type != undefined)
   if (obj.type.toLowerCase() == 'submit') ...


However if this is truly a condition that should never occur if I'm mixing the frameworks properly (e.g. any time this method is run one should expect the obj to have a type), I'd appreciate any pointers to where I should look to do it right.  And also if that's the case, it would seem the obj.type.toLowerCase() should be moved outside of the try/catch so that people who aren't using Firebug can know they've got an error in their code!

Thanks much,
HF.


Tue Oct 30, 2007 5:07 am

hostilefork
Offline Offline
Send Email Send Email

Forward
Message #20157 of 52127 |
Expand Messages Author Sort by Date

Hello all, I just found YUI and Ext-Js and read they could be mixed together if you use a YUI "adapter". So after following the basic instructions of library...
hostilefork
Offline Send Email
Oct 30, 2007
5:07 am

... That will work. Or, you can evaluate the condition in one If statement: if(obj.type !== undefined && obj.type.toLowerCase() == 'submit') You can then...
tssha
Online Now Send Email
Oct 30, 2007
2:08 pm

... Hi Thomas, Thanks for the response. If this is truly the case that the try/catch is being used to detect undefines, does anyone consider removing it to be...
hostilefork
Offline Send Email
Oct 30, 2007
6:58 pm

... This is progress and will be introduced in the next version -- 2.4.0. Regards, Thomas...
tssha
Online Now Send Email
Oct 30, 2007
8:30 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help