开发者

Dojo vs JQuery programmatic widget creation

I recently experimented with Dojo and figured that given a single dom开发者_JS百科 node in the markup, I can construct the whole UI tree in an object oriented manner i.e., programmatically and not having to worry about escaping ids and making code like data. My question is in JQuery, is the same possible. My markup has a single root div and everything else needs to be added in response to some program event. I am hearing a lot of good things about JQuery and wondered if this was possible I could switch. Could someone provide an example or pointers?


It's possible to accomplish something similar with jQuery, but jQuery out of the box doesn't have the same notion of programmably created widgets that Dojo has. The closest that jQuery offers is the Widget Factory that is part of jQuery UI -- it is somewhat similar to what Dojo offers via dijit._Widget, but it doesn't offer a notion of templated widgets like Dojo does. You also lose out on attach points and attach events.

All of that said, you can certainly use jQuery to append things to your DOM at runtime, rather than creating your DOM via HTML. The facilities for doing so just aren't as comprehensive in jQuery as they are in Dojo.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜