Releasing DOMAssistant 2.6 - overall fastest CSS selectors, plugins and more
February 20th, 2008 by Robert NymanToday marks the beginning of a new stage for DOMAssistant. It is time for version 2.6 to see the lights of day, and it is packed with improvements, features and an infrastructure to back it up!
What’s new
Overall fastest CSS selector performance in the market
One of things we have focused very hard on with this release is performance. Performance is vital in any web site or application, but it is often overlooked, or at least underrated. Therefore, a lot of work has gone into fine-tuning the CSS selectors in DOMAssistant, to give results as fast as possible, while also making sure the selectors return accurate matches.
I’m proud to say that DOMAssistant currently has the fastest overall CSS selector performance, where it is noticeably faster than the other JavaScript libraries in all web browsers, but Internet Explorer. In Internet Explorer, it is the second fastest (marginally faster than jQuery), behind Ext JS.
Take the Slickspeed test to see for yourselves (my opinions about the Slickspeed test)!
Using querySelectorAll and native getElementsByClassName
Safari has implemented querySelectorAll in their latest nightly builds of WebKit, which means that it will be in an upcoming version of Safari. It is a native support (and in a W3C draft) for using CSS selectors to select elements, and the results are astounding! Download a nightly build of WebKit (don’t worry, it won’t mess up existing installations) and hold on to something!
Upcoming versions of Safari, Firefox and Opera will support getElementsByClassName natively, so DOMAssistant utilizes that where it’s available.
XPath
Where querySelectorAll and getElementsByClassName aren’t available, DOMAssistant resorts to XPath to select elements, which is an approach that also has very impressive performance results, not to mention native web browser support. The only web browser not supporting XPath is Internet Explorer, where the only option is “regular” looping through elements.
Plugins
The idea is to keep the DOMAssistant core functionality as small, slimmed and optimized as possible, while we definitely respect and understand the needs other web developers, as well as us, have regarding extending that functionality. Now DOMAssistant offers an extremely easy-to-use plugin functionality, which hooks in on top of the DOMAssistant core.
For example, you might need a script to validate all the input fields in a document, if they have the class mandatory. Just customize your own validate function and use the plugin approach to add it to the DOMAssistant core. For example, your syntax can then look like this:
$("#contact-form input.mandatory").validate();
Read more about how to do it in How to create a plugin.
All plugins created will be publicly listed in the plugins page, sorted into categories so you can find the type of plugin you’re looking for. If you feel a certain plugin is missing, feel free to submit your own plugin.
The $$ method
In earlier versions, there has been some confusion about what to send in to the $ method. It would accept plain ids, CSS selectors and objects. However, by supporting the mix of ids and CSS selectors, it ruled out sending in just a certain tag, since it would then be interpreted as an id rather than a CSS selector.
With the new plugin structure in place as well, this change was inevitable. It had to become consistent so everyone could start adding their own functionality, and get back expected results.
Another factor was that there are times when there’s a need to work directly with properties and methods on the native DOM element (e.g. offsetHeight, style etc), whereas the $ method returns a DOMAssistant collection of elements mainly intended for DOMAssistant methods and chaining.
Therefore, we have decided to introduce the $$ method, which returns a direct DOM reference, but with all the extra DOMAssistant methods applied to it as well. So, to summarize:
- The
$method -
Accepts either a CSS selector or an object reference. E.g.
$("#container .external-links"),$(document). Fails silently if you try to call a method when the selector didn’t return any matches; i.e.,$("input[type=text]").addClass("text-fields")won’t throw an error trying to call theaddClassmethod, even if the$selector didn’t match any elements.Returns: A collection of one or several nodes for CSS selectors/object reference when an object was sent in.
- The
$$method -
Accepts a string parameter, expected to be the
idof an element. E.g.$$("container"),$$("navigation"). Will throw an error if you try to call a method, if there wasn’t any match.Returns: A direct reference to the DOM element.
Backwards compatibility issue
The result of this is that if you have used the $ method and only passed in ids, then it will not work with this new release. It will be regarded as a CSS selector and element names. I am truly sorry for this, but it was vital for the future of DOMAssistant.
But fret not! The very simple solution for those scenarios is to just replace $ with $$, and it will work exactly as before! So, make the change now and you should be DOMAssistant future compatible.
Support for multiple simultaneous AJAX calls
Before, the get and post methods would just allow one call at the time, and if another was started before the previous had finished, the previous call got cancelled. This has now been addressed, so you can have as many simultaneous calls as you want.
Bug fixes
- Fix for
addContentmethod calls on a collection. - Fix for
replaceContentmethod calls on a collection. - Fix for id bug in Internet Explorer and Opera, where it matched elements with that name as well (id and name mixups bug).
- Removed unnecessary attribute removal in the replaceWithAJAXContent method for the AJAX module.
- (Re)Added support for XUL events (DOMMouseScroll etc) with the addEvent method (this fell out in between versions).
Infrastructure
Talking about infrastructure, I mean what has happened around the DOMAssistant JavaScript library.
Discussion forum
Something that has been asked for numerous times is a public forum where peole can ask questions about or discuss DOMAssistant. Now there is a DOMAssistant discussion forum where anyone can get help, or discuss how to implement a certain thing
The DOMAssistant Team
A DOMAssistant team has been formed, and its tasks consist of testing DOMAssistant, helping out in the discussion forum, evangelizing, analyzing and helping out with the code itself and general advisory functions. They are invaluable to DOMAssistant, and the team members are:
- Lim Cheng Hong
- Pelle Wessman
- Roger Johansson
- Gustaf Forsslund (in Swedish)
- Carsten Witt
- Gustaf Lindqvist
Offline documentation
Something which has been requested is the ability to download the DOMAssistant documentation to read it through or print it, without having to use the DOMAssistant web site itself. Now there’s a PDF download in the documentation section to cater to those needs.
Web site and blog
Previously, DOMAssistant was hosted at http://www.robertnyman.com/, but it had to stand on its own. It also features this blog to talk about DOMAssistant or general JavaScript topics, and to make announcements about releases.
What about animations?
I’ve gotten a lot of feedback from people saying that they love DOMAssistant, but now and then they have a need to use animations in a web page. My philosophy is to have as little as possible in the DOMAssistant core code, I’d rather take things out than add more methods, and I don’t regard animation functionality as being important enough to be in there.
However, of course there’s a need for animations, and just as we speak, Pelle of the DOMAssistant team is working hard on putting together a plugin to DOMAssistant with just that. Stay tuned, we’ll alert you in the blog as soon as it’s available.
Till then, feel free to extend DOMAssistant with your own plugin!
Try DOMAssistant out!
Now download DOMAssistant and try it out. Write your own plugins and enhance your existing web sites!
February 20th, 2008 at 1:02 pm
[…] There are a number of improvements and new goodies in the new 2.6 version, so please check out the release blog post in the DOMAssistant blog. […]
February 20th, 2008 at 3:54 pm
[…] The JavaScript-library of my choice and which I’m part of the team behind, DOMAssistant, has been released in a new version. […]
February 20th, 2008 at 11:14 pm
Hi, I really enjoy your work Robert. I did not had the chance to use your library, but I feel inspired about the hard work you put into this. So tomorrow I will take the time to play around with it and hopefully start programming some plug-ins
I was searching for a good libary lately, but all seem to be bloated to begin with. And finding a good way to just include the necessary modules in Ext, YUI and co. are just to time consuming!
I believe that your libraray has a good chance to become a very popular libraray for people like me who don’t want to rely on stuff from others and prefer to do it by themselves. Your library gives me the opportunity to start working on my own extensions as I see fit. Thanks
Hope I can contribute something useful!!!
February 21st, 2008 at 12:09 am
Georges,
Thank you for those kind words!
Please try out the plugins structure and let me know how it works out for you!
February 21st, 2008 at 2:50 pm
Congrats on the new release Robert!
February 21st, 2008 at 4:00 pm
[…] 2.6 Released DOMAssistant 2.6 has been released and the team focused on performance for this […]
February 21st, 2008 at 4:25 pm
Rey,
Thank you!
February 21st, 2008 at 6:07 pm
[…] DOMAssistant 2.6 has been released and the team focused on performance for this version. […]
February 22nd, 2008 at 1:08 pm
[…] der Bereitstellung der Version 2.6. des DOMAssistant hat das Entwicklerteam um den Schweden Robert Nyman ein wahres Kunststück in Sachen […]
February 24th, 2008 at 4:09 pm
[…] DOMAssistant 2.6 has been released and the team focused on performance for this version. […]
February 25th, 2008 at 1:19 am
[…] There are a number of improvements and new goodies in the new 2.6 version, so please check out the release blog post in the DOMAssistant blog. […]
February 29th, 2008 at 2:39 am
[…] Releasing DOMAssistant 2.6 – overall fastest CSS selectors, plugins and more […]
November 3rd, 2008 at 8:42 am
omg, why doomassistant method addcontent fail to insert a row in table element when I use Internet Explorer ;< Does anybody know how to fix it?
December 27th, 2008 at 5:01 pm
mhifamvfaiyhhdudwell, hi admin adn people nice forum indeed. how’s life? hope it’s introduce branch
March 3rd, 2009 at 3:27 pm
Hello webmaster
I would like to share with you a link to your site
write me here preonrelt@mail.ru
July 14th, 2009 at 2:01 pm
Pretty cool post. I just stumbled upon your blog and wanted to say
that I have really liked reading your blog posts. Anyway
I’ll be subscribing to your blog and I hope you post again soon!
August 5th, 2009 at 5:27 am
Harbans Lal Gera - I know this is off topic but need help with Vista
Thanks,
Harbans Lal Gera
October 13th, 2009 at 7:38 am
[…] For Robert’s own, more detailed, description of the news and changes in DOMAssistant 2.6, read his post on the DOMAssistant development blog: Releasing DOMAssistant 2.6 – overall fastest CSS selectors, plugins and more. […]
March 5th, 2010 at 3:04 pm
Naught shemale posts are the best thing ever , post more please!
March 6th, 2010 at 3:08 pm
Domme ladies makes me so haèèy , why dont you post some more?
March 7th, 2010 at 2:42 pm
I just think you have wrote an hot piece of post , thank you and … bookmarked!
March 10th, 2010 at 5:50 pm
I just think you have wrote an hot piece of post , thank you and … bookmarked!
March 10th, 2010 at 6:55 pm
Sexy dommes like this one makes my day like nothing else please post some more i ll be thankful