> From: Klaus Hartl
> 
> Yeah! I like how it is build on top of my basic cookie plugin 
> instead of rebuilding stuff...
> 
> Another example how well the plugin architecture works out.

...except that there's no "plugin architecture" at work here. :-)

These three plugins don't really need jQuery at all. They use window.jQuery
as a convenient namespace for their functions, and they use the simple
jQuery.trim() and jQuery.extend() functions.

Here is all the "jQuery" that these plugins really use:

   <script type="text/javascript">
      jQuery = {
         trim: function( t ) {
            return t.replace( /^\s+|\s+$/g, "" );
         },
         extend: function() {
            var prop, target = arguments[0], a = 1;
            while ( (prop = arguments[a++]) != null )
               for ( var i in prop ) target[i] = prop[i];
            return target;
         }
      };
   </script>

Load that in a page without jQuery, then load the cookie, JSON serializer,
and cookieJar plugins after that. They will work perfectly!

Don't get me wrong, it's nice to package up this kind of code as a jQuery
plugin - I've done it myself several times - but really they are just good
solid pieces of reusable code that happen to be packaged as plugins.

And of course, reusable code - and even things like chainable methods [1] -
were around long before jQuery.

I'm not pointing this out to take anything away from what everyone has done
with jQuery and its plugins, just to offer a little perspective. :-)

-Mike

[1] For example, "str.replace(/a/,'b').replace(/c/,'d').replace(/e/,'f')".

Reply via email to