jquery/jquery-ui — pull request #520 by snesin (2011-11-08 04:54:45+00:00)
Title: Integrate widgets with jcade if available

widget: integrate widgets with jcade if available. New feature - widget: automatic instantiation of widgets.

jcade provides automatic instantiation of classes by className. If jcade is included before a widget, the widget will automatically be instantiated on every element that has the class path in the className attribute. For example, the HTML author would only have to write:

<a class="jQuery.ui.button">hello world</a>

to make the anchor a jQuery UI button. The author would not have to track insertions and call $(selector).button() on each. The instantiation is triggered regardless where or when the element is added to the document, or how the element was created (via source, innerHTML assignments, jQuery methods, or methods from other frameworks).

Options can be passed using "classname:options" or "fullclasspath:options" attributes on the HTML element. For example, to disable an anchor button, the HTML author can write:

<a class="jQuery.ui.button" button:options="disabled:true">hello world</a>

or (fully qualified):

<a class="jQuery.ui.button" jQuery.ui.button:options="disabled:true">hello world</a>

See https://github.com/snesin/jcade for more information.

Existing declarations are unaffected. If jcade was not included by the page author, automatic instantiation does not happen and widgets are attached manually as before. The page author can weigh the pros to cons of using jcade and have the option of automatic binding of widgets.