Takazudo hamalog

programming notes. mainly about JavaScript / jQuery. [@Takazudo] [takazudo@gmail.com] Hint: alt + /

cool guy

jQuery.sub() encapsulation

2011/09/06 permalink

I’ve never used jQuery.sub() but I noticed that this is pretty useful.
Here’s an example.

The instance that jQuery.sub returns is an jQuery’s subclass.
This means that all prototype methods attached to this local jQuery do not consume jQuery.prototype of global jQuery.

This is pretty useful when you want to make a tiny plugin for limited use.

Thanks @kyo_ago ;D

blog comments powered by Disqus