Hi folks,
currently jQuery does not try to handle any programming errors by clients, eg.
an expression like "[EMAIL PROTECTED]", that is missing a closing bracket "]",
can result in quite confusing behaviour and is hard to spot. In other places,
like the problem described in bug #165 ( http://jquery.com/dev/bugs/bug/165/ ),
just catching the exception without handling it is a very bad habit, but
somewhat necessary to keep the code small.
My idea is a small addition, that checks for the existence of a "logging"
object and uses that to log exceptions or potential errors. This addition could
be included by developers before jQuery and could help greatly when developing
and debugging. For production code, the remaining code would add only a very
small overhead. I'm not sure if this overhead should be removed, eg. by the
build script when packing the code. Or if it should be kept inside the core to
enable debugging a live site by including the additional script before jQuery,
without having to change the jQuery core code itself.
In the case of the problem described by Klaus, the logging could look like this:
var modRes;
try {
modRes = xml.getResponseHeader("Last-Modified");
} catch (e) {
;;;if(typoeof $.log != "undefined") { $.log.error(e); }
}
if ( ifModified && modRes ) jQuery.lastModified[url] = modRes;
The three semicolons would allow the packed to remove the line...
Opinions are very welcome!
-- Jörn
--
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/