Is there a project (open source) that takes the widgets and plugins for jQuery UI but allows us to use them without setting up any HTML?
Kinda like Ext-js and Sprout
What's stopping you from using JavaScript and jQuery UI like this right now?
To the best of my knowledge, loading a web page in a current-generation web browser requires an (X)HTML document, but nothing's preventing you from making that document a stub and building your application entirely in JavaScript.
DHTMLX is similar to ExtJS, which unfortunately includes sharing some of its disadvantages.
You should take a look at Google Closure:
http://code.google.com/closure/
In my opinion, it matches exactly what you are asking for.
Let's see if I understand the question. Instead of
<script>
$(function(){
$('a').button();
});
</script>
<body>
<button id="foo">Foo</button>
<button id="bar">Bar</button>
</body>
You want
<script>
$(function(){
$('body').append($('<button>').attr('{ id: "foo" }').html('Foo').button());
$('body').append($('<button id="bar">Bar</button>').button());
});
</script>
<body>
</body>
Does that meet your needs? At the end of the day you'll still need to specify the details of the button (where it goes, its text, what happens when you click it) no matter what the syntax is.
I don't think a suitable DSL exists at the moment, the closest thing I can think of is CoffeeScript
http://jashkenas.github.com/coffee-script/
It would also be a good starting point to build from.
As "Mr. Shiny and New" pointed out the following code would work:
$('body').append($('<button>').attr('{ id: "foo" }').html('Foo').button());
However the style you are looking for can be accieved by using the appendTo() function:
$('<button id="foo"></button>')
.button({
label: "Hello world!",
}).click(function () {
//doSomething
}).appendTo('#test');
Furthermore the code above returns the "button" object which allows you to assign the object to a variable for future reuse:
// set up the button
var a = $('<button/>').button({
label: 'Hello world!'
}).offset({
top: 80,
left: 120
}).width(180).height(24)
.click(function () {
// dosomething
}).appendTo('body');
// hide then show and rename (if it takes your fancy)
a.hide(300, function () {
a.show(300, function () {
a.button( "option" , {
label: 'Hello to the world again!'
});
});
});