Check out a free preview of the full jQuery Plugins and jQuery UI course:
The "Safeguarding Plugins" Lesson is part of the full, jQuery Plugins and jQuery UI course featured in this preview video. Here's what you'd learn in this lesson:

Safeguard your plugins by wrapping them in an “immediately-invoked function expression” – keeping variables from leaking to the global scope. Example: Calling color finds that it doesn’t still work – but why? – because here, color is defined on the old method but the defaults no longer exist. Deal with this bug by using jQuery.extend to extend function with the old function without losing your defaults. One rule of writing plugins: Never take more than one name! The purpose of this section has been to show potential problems with writing plugins.

Get Unlimited Access Now