Lately I've been working on a personal project, Deft, which is a JavaScript framework. Like everyone else I've been using existing frameworks to develop with. But over time I have gained a better understanding of the language and an idea of what methods a framework should offer. Deft is my effort to bring that idea to reality.
The following is an extremely quick glimpse of the functionality offered by Deft-0.5.js, an early build. In this post I will be focusing on working with elements. The framework is not complete so there will be more to come. But there is already a great deal of functionality.$('header')
.attr('style', {
'color': 'red',
'font-weight': 'bold'
})
.$('nav')
.attr('style', {
'opacity': 0.5
})
.back()
.addClass('ready');
In this example the element with an ID of 'header' is selected and its color and font-weight styles are set. An element within 'header' with an ID of 'nav' is then selected and a 50% opacity is applied. The chain then uses back() which returns to $('header') to which we end with adding a class of 'ready.' $$('span.good').each(function(o) {
o.identify();
});
In this example all spans with a class of 'good' are selected. We then loop through them and use identify() to assign a unique ID if one does not already exist.$('nav').purge();
In this example the element with an ID of 'nav' is removed.$('dataset').store('limit', 15);
$('dataset').store({
page: 0,
useFilter: false
});
alert($('dataset').fetch('limit'));
// alerts '15'
alert($('dataset').fetch('useFilter'));
// alerts 'false'
Above is a quick overview of how to store information in an element and fetch it later when needed.
If you are interested in taking a deeper look at the framework be sure to look at the official website. Right now the site is pretty basic. A blog and documentation section are in the works.
If you want to say it 'looks an awful lot' like any framework syntax, I'd say MooTools before jQuery. jQuery is actually the lowest source of inspiration for this project.
I'm guessing you don't have much JavaScript framework experience outside of jQuery.
i think i'll be coming back here for some more tips.