jQuery is OpenAjax Compliant

Posted on by

OpenAjax Alliance

A new initiative has been forming, over the recent months, in an attempt to standardize the different Ajax and JavaScript codebases that exist. A number of corporate entities have come together to draft the new OpenAjax standard (including IBM, Adobe, Opera, and Mozilla).

Today we’re announcing a new plugin that you can use to make jQuery OpenAjax compliant. By doing this, jQuery is becoming one of the first projects that has made its codebase compliant with the new standard.

Currently, the requirements for compliance are, relatively, simple – but still quite important. The relevant rules can be summarized as such:

  • All libraries must register themselves (their name, version, and namespace) with the main OpenAjax library.
  • All libraries must register any global variables that they use (in the case of jQuery it’s ‘jQuery’, and optionally ‘$’ – it defaults to just including ‘jQuery’).
  • Any attempt to register “onload” or “onunload” handlers must go through the OpenAjax library. In the case of jQuery, if you do: $(window).load(function), and OpenAjax is included, jQuery will defer to OpenAjax’s solution.
  • Libraries must not disrupt the ability of other libraries to traverse the HTML DOM document.

You can view jQuery’s compliance results, to verify that it does, indeed, past the test suite.

If you wish to use jQuery in conjunction with other OpenAjax-capable libraries, the process is rather straight forward.

Step 1 Download a copy of the jQuery OpenAjax plugin to your server.

Step 2 Include the library in your site, just after you include jQuery.

<script src="jquery.js"></script>
<script src="jquery.openajax.js"></script>

Be sure to include both jQuery and the jQuery OpenAjax plugin after you’ve included the official OpenAjax library itself.

And that’s it! jQuery will now happily play with the OpenAjax core library.

It should be noted that, currently, jQuery is not part of the OpenAjax Alliance, but we’re in the process of applying and are eager to begin actively participating.

10 thoughts on “jQuery is OpenAjax Compliant

  1. I think you should avoid to hardcode the jquery version number in the plugin:
    OpenAjax.registerLibrary(“jQuery”, “http://jquery.com/”, “1.1”);
    It should be better that the plugin checks that JQuery is indneed loaded before registering JQuery to the OpenAjax library and use is version string:
    OpenAjax.registerLibrary(“jQuery”, “http://jquery.com/”, JQuery.fn.jquery);

  2. This “new initiative” seems at first to be a good idea. However, in reality it looks like a rather bad library that takes all of the worst solutions to common problems and stuffs them into a bloated and poorly written JavaScript file. It favours attachEvent over addEventListener. Its “markup scanner” is in fact a slow and ponderous DOM walker. It creates lots of meaningless global variables despite proclaiming that it will prevent this. I want to like it but it’s so bad that I can’t. Am I missing something?

  3. So far I am not thrilled! :-( What is the benefit for us as a jQuery user? I mean, why should WE go for an OpenAjax compliance?
    From what I understand, it will make our jQuery installation slower because it’s relies at some part on OpenAjax functions.

  4. @Dean: We’ve recently had a number of inquiries about OpenAjax compliance, specifically from corporate users that want to have an assurance of interoperability. We’ve created this as a plugin so that these users can use jQuery in this setting but users that don’t need to have OpenAjax compliance can continue to use jQuery in its current form.

    @Dominik: Its a plugin so if you’re in a situation where you need to adhere to OpenAjax standards, we now provide the option. If not, you can continue to use jQuery as you normally would.

  5. While I haven’t seen the actual library and therefore can’t comment, I can comment on the value (or lack thereof) of this so-called ‘Open’-Ajax initiative. At best, this seems to be an attempt to fix something that isn’t broken, and at worst, a thinly-veiled attempt at imposing corporate control over an open standard. Frankly, I’m surprised Microsoft itself isn’t leading the charge.

  6. @Nate: I hear ya. Its a tough call though because you want to be able to help people who require that level of compliance while still ensuring the ability for the project to grow in the direction that you want. I think we’ve struck a good balance here.

  7. Hmm… Like a few people here I’m not totally pro OpenAjax.

    It has its upsides and its downsides.

    The pros are that corporate developers need intercompatability, and OpenAjax aims to do this. This should hopefully bring more users to jQuery.

    The cons are that I don’t think that some of it is very good. I’ll point to Dean Edwards for his analysis as he raised the same points that are on my mind. Still, it’s a plugin so inclusion and usage is not required.

    On the whole though, it’s good that John and co are looking to really push jQuery out there, as evidenced by the Ext announcement, so well done!

  8. I don’t see what all the bitching is about. It’s a plugin. If you need it, use it, if you don’t, don’t.

    This is what makes jQuery so powerful, having the ability to add stuff like this through plugins and not touching any of the core code.

  9. Tony, you can ‘add stuff like this’ with all the JS frameworks around. jQuery is not the only one to do this, and isn’t even the best at it.

    If you don’t see what the bitching is about, then I suggest you look into OpenAjax and form an opinion on it.

    I’m concerned that, as the ‘standard’ is still a while away from stability, more requirements will be added, and it will become harder to comply, and more rigidity will result. This obviously isn’t good for jQuery as a whole. If there aren’t any concessions on the part of jQuery core further down the road, then there won’t be a problem, but it really is a case of ‘wait and see’.

  10. @All: I’ve posted my thoughts on the matter here:
    http://ejohn.org/blog/thoughts-on-openajax/
    Sorry, but I wasn’t able to keep it under 1400 words ;-)

    @Dominik: This plugin will do nothing to effect the speed of your jQuery code. Nor is it required that you even use the plugin (you would only include it if you were inclined to use the OpenAjax Hub, and have jQuery plug into it). At this point, I don’t see a reason for including this code in jQuery core.