I am looking for a JavaScript framework that provides encapsulation of UI widgets, and allows the developer to define composite widgets开发者_高级运维. In particular, I need to be able to take a widget, clone it, and place it somewhere in the document, and the widget should take care of managing any subwidgets and of keeping matching DOM objects and JavaScript object in sync. I want to be able to take a multi-item form, where each item contains multiple widgets, and tell it to add or remove an item, without having to write specific code for each form, handle the subwidgets explicitly, reinstalling event handlers, etc..
Is there any JavaScript framework that offers such a feature. If not, which one comes closest? So far I know that jQuery doesn't (its focus is on providing an interface for DOM manipulation, not to encapsulate complex entities).
jQuery
's UI Widget Factory provides you methods to create widget classes.
jQuery UI Widgets enforces follow it's coding style. It' provides all that you seek. You can also make your widgets theme-able by making use of ThemeRoller
Refer jQuery UI Developer Guide, Tips for Developing jQuery UI 1.8 Widgets , Understanding jQuery UI widgets: A tutorial
精彩评论