Releasing DOMAssistant 2.6 – overall fastest CSS selectors, plugins and more

February 20th, 2008 by Robert Nyman

Today 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 the addClass method, 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 id of 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 addContent method calls on a collection.
  • Fix for replaceContent method 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:

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!

79 Responses to “Releasing DOMAssistant 2.6 – overall fastest CSS selectors, plugins and more”

  1. [...] 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. [...]

  2. [...] The JavaScript-library of my choice and which I’m part of the team behind, DOMAssistant, has been released in a new version. [...]

  3. 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!!!

  4. Robert Nyman says:

    Georges,

    Thank you for those kind words!
    Please try out the plugins structure and let me know how it works out for you!

  5. Rey Bango says:

    Congrats on the new release Robert! :)

  6. [...] 2.6 Released DOMAssistant 2.6 has been released and the team focused on performance for this [...]

  7. Robert Nyman says:

    Rey,

    Thank you! :-)

  8. [...] DOMAssistant 2.6 has been released and the team focused on performance for this version. [...]

  9. [...] der Bereitstellung der Version 2.6. des DOMAssistant hat das Entwicklerteam um den Schweden Robert Nyman ein wahres Kunststück in Sachen [...]

  10. [...] DOMAssistant 2.6 has been released and the team focused on performance for this version. [...]

  11. [...] 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. [...]

  12. [...] Releasing DOMAssistant 2.6 – overall fastest CSS selectors, plugins and more [...]

  13. kuse says:

    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?

  14. [...] 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. [...]

  15. victoria says:

    very helpful, i know you probably see these comments all the time but it really is, thank you

  16. michael says:

    In CSS, pattern matching rules determine which style rules apply to elements in the document tree. These patterns, called selectors, may range from simple element names to rich contextual patterns. If all conditions in the pattern are true for a certain element, the selector matches the element.
    testking ccnp
    The case-sensitivity of document language element names in selectors depends on the document language. For example, in HTML, element names are case-insensitive, but in XML they are case-sensitive.

  17. Konkurrencer says:

    Always look around the bright side of life is among my favorite sayings, as you carry out in your submit you try to not only concentrate on the negative but in addition on the positive in every a feeling of the way, it’s nice to read your posts, and you also bring a lot of happiness in to other peoples lifestyle with them, keep coming with your awesome articles.

  18. Corazon Koor says:

    Great awesome things here. I¡¦m very happy to see your article. Thanks so much and i’m having a look ahead to contact you. Will you kindly drop me a mail?

  19. Hello there! I just wish to give you a huge thumbs up for the great information you’ve got here on this post.
    I am returning to your website for more soon.

  20. Mark Twain was one of the most famous and well-loved authors in the world.
    Select basic tile for the majority of your area, and then also use the brand
    name tiles to embellish the design. 8 Million Pounds of Electronics Reused or Recycled, at.

  21. It’s remarkable to visit this site and reading the views of all friends on the topic of this
    post, while I am also keen of getting experience.

  22. Candelaria says:

    Lenovo Idea – Pad is perfect for storing and
    carrying around sensitive data. There are many benefits that can be obtained when buying Cleaning Supplies Brisbane in bulk.

    The collective strength of the five forces then determines how attractive the industry is to potential entrants ( i.

  23. Anonymous says:

    Paying for Farmville cheat codes If you’ve searched for Farmville cheat codes, you
    might run into a few “entrepreneurs” trying to cash in
    on Farmville’s popularity. A free workaround so you can get unlimited lives on a game that’s already causing neglect at your workplace, tension in your body, and strife among loved ones who feel marginalized and unattended.
    Some of these games will require you to pay a monthly fee.

    Feel free to surf to my web-site; Chef Ville t

  24. Ryder says:

    Howdy! This is kind of off topic but I need some advice from an established blog.
    Is it very hard to set up your own blog? I’m not very techincal but I
    can figure things out pretty quick. I’m thinking about creating my own but I’m not sure where to begin.
    Do you have any points or suggestions? Cheers

    my page … forex trading (Ryder)

  25. It Works says:

    I read this piece of writing completely regarding the difference of hottest and previous technologies, it’s remarkable article.

    My blog post: It Works

  26. Anonymous says:

    That is a very good tip particularly to those new to the blogosphere.
    Short but very precise information_ Thanks for sharing
    this one. A must read post!

  27. Torri says:

    Greeat blog! Do yyou have any helpful hnts for
    aspiring writers? I’m planning to start my own blog soon but I’m a
    little lost on everything. Would you recommend starting with a free platform like WordPress or go for a paid option?
    There are so many options out there that I’m ompletely overwhelmed ..
    Any tips? Appreciate it!

  28. Dan says:

    Appreciation to my father who told me regarding this website, this blog is really remarkable.

  29. Write more, thats all I have to say. Literally, it seems as though
    you relied on the video to make your point. You clearly know
    what youre talking about, why throw away your intelligence
    on just posting videos to your weblog when you could
    be giving us something enlightening to read?

  30. Christine is the real deal with no hype and no filler either.

    You clearly have to think about who will come to your site above all else because the people who do come onto
    your site are the ones who will be more likely to actually buy things from it.
    As discussed earlier, traditional marketing is less effective and
    expensive.

  31. Thanks , I’ve recently been looking for info about this subject for a long time and youres is the best I have found out
    so far. But, what in regards too the conclusion?
    Are you certain in regards to the supply?

  32. Johng489 says:

    I truly appreciate this post. I’ve been looking everywhere for this! Thank goodness I found it on Bing. You’ve made my day! Thank you again! dfekdcdkkgca

  33. s home screen of the original style of the mark, or any of the applications.

    In addition, if you are an experienced Android
    application developer you can effectively recover rates.
    The difference between ROM and PROM is that, in PROM the
    programming is applied after the device is constructed.

    Also visit my site; Family Guy The Quest For Stuff cheats download

  34. What’s up it’s me, I am also visiting this site on a regular basis, this
    website is actually pleasant and the visitors are in fact sharing pleasant thoughts.

    My webpage – drukarnia wielkoformatowa Opole

  35. Iona says:

    Hello to all, as I am in fact eager of reading this weblog’s post to be updated regularly.
    It includes fastidious stuff.

  36. Ӊello tɦіs іs kinnda of off topic buut Ι աas ѡanting tο kmow іf blgs սse WYSIWYG editors οr іf ʏоu Һave
    tto manually code աith HTML. ӏ’m starting ɑ blog soon ƅut ɦave noo
    coding skills sߋ Ι wanjted tօ ɡеt guidance
    from ѕomeone ԝith experience.Any ɦelp ѡould ƅe enormously appreciated!

    ңere іs my web site: Noclegi Pobierowo

  37. What’s up i am kavin, its my first time to commenting anywhere, when i read this
    article i thought i could also create comment due to this brilliant piece of writing.

  38. Dian says:

    I agree with this (although I believe a few come
    very close,) however, I do think some Linux distributions are leaps and bounds ahead of others in certain areas that we can classify.
    2003 Ford Focus ZX3: FWD, 130 hp, 5300 rpm, 135 lbs.
    The game Need for Speed was owing to the release of successful gaming
    franchises, and also as it was the forerunner it was paid heavy dividends,
    besides receiving reviews flowing with tremendous optimistic
    feedback.

  39. Ralph says:

    Have you ever thought about creating an ebook or guest authoring on other websites?
    I have a blog centered on the same topics you discuss and
    would really like to have you share some stories/information.
    I know my readers would enjoy your work. If you are even remotely interested, feel
    free to send me an e-mail.

  40. The World Wide Web is an important marketing medium and to gain success in this arena a
    marketer should have well planned online marketing strategy.

    Before engaging an online marketing consultant therefore, make sure they have all
    of these skills and more, in order for them to offer you a great value proposition. Regularly improve and update your products to enable you build a solid connection with your customers.

    Here is my web page … chicago schools

  41. Pretty component to content. I simply stumbled upon your website and in accession capital to assert that I get in fact enjoyed
    account your weblog posts. Any way I’ll be subscribing on your augment or even I success you get right of
    entry to persistently fast.

  42. Hi there, You have done a great job. I will definitely digg it and personally suggest
    to my friends. I am confident they’ll be benefited from this web site.

  43. Anonymous says:

    Do you have a spam issue on this site; I also am a blogger,
    and I was wanting to know your situation; many of us have developed some nice practices and we
    are looking to swap techniques with other folks, please shoot
    me an e-mail if interested.

    my webpage :: Gerontophilia T

  44. Awesome site you have here but I was wanting to know if
    you knew of any discussion boards that cover the same topics talked
    about here? I’d really love to be a part of online community
    where I can get feed-back from other experienced people
    that share the same interest. If you have any recommendations, please let me know.
    Thank you!

    My site – Edge of tomorrow 2014 Telecharger

  45. Thank you for the good writeup. It if truth be told was a leisure account it.

    Glance complicated to more delivered agreeable from you!

    However, how can we communicate?

  46. Anonymous says:

    Hi, i read your blog from time to time and i own a similar one and
    i was just curious if you get a lot of spam feedback?
    If so how do you stop it, any plugin or anything you can advise?
    I get so much lately it’s driving me crazy so any
    support is very much appreciated.

    Here is my web page – Pat

  47. Hello there, just became alert to your blog through
    Google, and found that it’s really informative. I am going to watch out for brussels.
    I will appreciate if you continue this in future.
    Many people will be benefited from your writing. Cheers!

  48. Hey, I think your website might be having browser compatibility issues.
    When I look at your blog in Safari, it looks fine but when opening in Internet Explorer, it has some overlapping.
    I just wanted to give you a quick heads up! Other then that, wonderful blog!

    Feel free to visit my web site foundation waterproofing contractors in Ontario

  49. Hi there, i read your blog from time to time and i own a similar one and i was just wondering
    if you get a lot of spam remarks? If so how do you stop it, any plugin or anything you can recommend?

    I get so much lately it’s driving me mad so any support is very much appreciated.

  50. Cathryn says:

    It’s wonderful that you are getting ideas from this post as well
    as from our dialogue made at this place.

Leave a Reply