DOMAssistant 2.7.4 out!

October 31st, 2008 by chenghong

Update:  Version 2.7.4 has been released to address a regression bug that affects the addClass(), removeClass() and replaceContent() methods. Please update to this version. Sorry if it has caused any inconveniences!

We are pleased to announce that your favorite Javascript library has just received an update! Yes, it’s a zero-point-zero-one version increment, but make no mistake about it - DOMAssistant 2.7.3, while continuing its promise of being extremely light and fast, sees the addition of some much requested features and fixes, including:

Support for “opacity” with getStyle() and setStyle()

You can now get or set the opacity of an element with the following syntax. It works across browsers, of course.

elm.setStyle("opacity", 0.5);
elm.setStyle({ color: "blue", opacity: 0.3 });
var opacity = elm.getStyle("opacity");    // 0.3

JSON response native parsing with eval fallback

If the responseType is set to “json” in an Ajax call, DOMAssistant will attempt to evaluate the response with the native JSON.parse function whenever possible.

elm.ajax({
    url: "getDateTime.php",
    responseType: "json",
    callback: function (obj) {
        var date = obj.date;
        var time = obj.time;
    }
});

Support for timeout and exception handling in Ajax

Two optional parameters, “timeout” and “exception”, have been added to Ajax setup config. As their names suggest, they allow you to define the timeout interval for an Ajax request, and an exception handler to deal with the situation whenever error arises. Timeouts are considered a type of error as well.

elm.ajax({
    url: "getDateTime.php",
    responseType: "json",
    callback: function (obj) {
        var date = obj.date;
        var time = obj.time;
    },
    timeout: 5000,    //in ms
    exception: function (err) {
        alert("Error: " + (err.message || err.description));
    }
});

Enhanced removeEvent() capable of removing all handlers binded to an event

Previously you must specify the event and the function reference if you need to remove an event handler. This means anonymous functions and inline event handlers could never be removed without some brute forces. This issue has now been addressed with the improved API that allows you to omit the function reference in a removeEvent() call.

elm.removeEvent("click", doSomething);   // Removes the doSomething click event handler
elm.removeEvent("click");                // Removes all click event handlers

Exceptional performance

DOMAssistant 2.7.3 now leads other major libraries by an even larger margin in selector’s performance. It also stacks up pretty well against up and coming libraries. Performance enhancement has been made in the Ajax department too, where requests are now pooled and reused. Special thanks to David DeCarmine on this one!

Other fixes

[Chg] Inline events now gets triggered with triggerEvent()
[Fix] Multiple selector accuracy fixes in edge cases
[Fix] getStatus() and getStatusText() now works from within the Ajax callback function
[Fix] getStyle() for “float”, “width” and “height” now return correct values in IE
[Fix] Event handle threw error under rare circumstances in IE

Download

DOMAssistant 2.7.3 is drop-in replacement for the last version and is available for download now. We hope you enjoy this release. Feedback welcomed!

Leave a Reply