Skip to content

JQuery Condom, Namespaces for Plugins

github.com/kuroir
4 pointskuroirdiscuss
On HN

jQuery Condom provides a namespace functionality which will allow you to create jQuery plugins on the fly; without touching the main jQuery.fn method. You have the same amount of control as if defining it from jQuery.fn.

This library is not meant to replace jQuery.fn, it's meant to work with it.

The jQuery official Plugin Authoring guide states: Under no circumstance should a single plugin ever claim more than one namespace in the jQuery.fn object. [source.]. And this library will help you follow that rule.

When you write a plugin (or any portion of code for that matter), you'll usually end up passing jQuery objects as attributes to methods; breaking the jQuery way (and sweet chains).

Comments

No comments yet.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.