> From: Michael Geary > > Also, that comma after the } shouldn't be there. It looks like you > > picked up the use of the comma from object literals...
> From: Jörn Zaefferer > Actually there is a single "var" at the top, therefore the > problem must be somewhere else... My fault, I should > remove that stuff from the tooltip. Ah! I missed that. So the whole thing is one long "var" statement. Interesting approach, and it explains what really went wrong in epaulin's code. Note my other comment: > Finally, you're missing a semicolon after "settings" in the > "var" list at the top. That won't affect anything unless you > try to run the code through a packer to compress it - then > you may have errors. Here's a stripped down version of the entire plugin: (function($) { var ... modalCloseBtn, settings /***** missing semicolon, I thought *****/ plugin = $.fn.Modal = function(defaultSettings) { ... }, modal_handle = function(event) { ... }, modal_parse = function() { ... }, ... modal_close = function(event) { ... }; plugin.defaults = { event: "", after: null, ... shadowOffset: 5 }; })(jQuery); So what was *really* missing here was a comma, not a semicolon - because the function definitions were all supposed to be part of that one "var" statement. Instead, the JavaScript interpeter sees that it can't parse the code as is, and it inserts a semicolon after "settings" - thus cutting off the function definitions from the "var" statement. The code still runs, but all those assignments have become globals instead of locals. Oops! I think I would change it to this: (function($) { var ... modalCloseBtn, settings; var plugin = $.fn.Modal = function(defaultSettings) { ... }; function modal_handle(event) { ... } function modal_parse() { ... } ... function modal_close(event) { ... } plugin.defaults = { event: "", after: null, ... shadowOffset: 5 }; })(jQuery); Or maybe just: (function($) { var ... modalCloseBtn, settings; $.fn.Modal = function(defaultSettings) { ... }; function modal_handle(event) { ... } function modal_parse() { ... } ... function modal_close(event) { ... } $.fn.Modal.defaults = { event: "", after: null, ... shadowOffset: 5 }; })(jQuery); -Mike _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/