After a recent discussion on the jQuery mailing list where someone wondered if “jQuery was OpenAjax compliant” I decided to fully investigate the OpenAjax Alliance.
In the purest sense, the goal of the initiative is to smooth over the interoperability in between JavaScript code bases. Currently that means:
- Keeping the global namespace clean.
- Making sure libraries don’t overwrite each others window.onload events.
- Keeping the global XML namespaces clean.
- Keep any attempts to walk to the DOM from breaking.
This is good. Those are simple tasks that many libraries can easily get behind.
Granted, in jQuery we: Already have all our code in one global namespace, we don’t promote the use of window.onload, we don’t inject (or require) elements into our own XML namespace, and we don’t overwrite any of the browsers default methods. Effectively, jQuery’s entire OpenAjax implementation is just to defer the use of (the rarely used) $(window).load(…) to the OpenAjax Hub.
Reality is never as good as it seems, though, as I have some issues with both the alliance and the OpenAjax Hub implementation.
The OpenAjax Alliance is very, very, corporate. The alliance is populated by 66 companies and 2 open source projects (one is an open source project, backed by a non-profit foundation and the other is a by-product of university research).
Ok, that’s fine – it’s corporations wanting to set some standards. Obviously, however, it should be apparent that a number of, very popular, Open Source Ajax-capable JavaScript libraries should join the alliance, if not, at the very least, be consulted about the proposed specifications.
Let’s assume that they simply haven’t taken the initiative, as of yet. Ok, that’s fine – jQuery would like to join the alliance (to provide our input, hopefully steering them in a positive direction). How would this occur?
I’ve read through the OpenAjax Alliance Members Agreement [PDF] a number of times now, and even enlisted the help of my, more-legally-inclined, friends but came up short. You’re allowed to join if you meet the following criteria:
“Members” means the entities which have signed the Members Agreement and whose membership in the OpenAjax Alliance has been approved in accordance with Section 3.1
(emphasis mine) and some more relevant info:
Membership in the Alliance is intended to be broadly available to all organizations or individuals with a demonstrated interest and commitment to the Purpose, which is the development, enhancement, and promotion of programming technologies and techniques based on HTML-based browsers, Javascript, HTTP, or other specifications to provide robust and effective client Internet interactions, including the publication of Alliance roadmaps, Specifications, testing materials, and sample implementations that can be used to promote OpenAjax programming technologies and techniques.
I understand everything except for the “organizations or individuals” statement. jQuery (and Mochikit, Mootools, Prototype) are all popular JavaScript libraries that have no legal backing (Yahoo UI has Yahoo, Dojo has the Dojo Foundation). Unfortunately, since these JavaScript libraries have no legal backing (as a non-profit corporation, for example) they seem to be out of luck.
For more answers I turned to the OpenAjax member wiki which includes this helpful snippet:
Companies (including non-profit organizations such as open source projects) can join OpenAjax Alliance by following the instructions found on the public web site at: http://www.openajax.org/join.html.
On an exceptional basis, individuals can join OpenAjax Alliance, but only after they have an established track record of involvement and contribution to OpenAjax Alliance efforts and after recommendation by an existing Member. In these exceptional cases, the individual must follow the same procedure as companies (i.e., follow instructions at http://www.openajax.org/join.html). At this point, no individuals have been accepted as Members into OpenAjax Alliance.
There’s a couple points about these paragraphs that greatly amuse, and confuse, me. First, that only legal entities (e.g. corporations, non-profit corporations, or individuals) can join the alliance. Second, that all open source projects must be non-profit corporations. Third, that no individuals exist within the alliance (nor do they seem to be particularly enthused by the concept).
All of this really boils down to the fact that if I want jQuery to join the alliance (and I as its representative), the project would have to have some sort of legal backing in order to hold up. I can’t sign a document claiming specific ownership rights, or control, over something that doesn’t, legally, exist.
This is all (hopefully) an overreaction. But the very fact that no non-legally-backed entities exist in the alliance (and the fact that no good corporation would sign a legal agreement ambiguously defining the status of an “organization”) leads me to believe that many of today’s poplar JavaScript libraries are intended to be left out of the drafting of the OpenAjax requirements.
The implementation of the OpenAjax Hub (Source) is another issue at play here.
The Hub is meant to be this over-arching library that all other code bases plug into. It is, then, from this library that it delegates out to the necessary resources. Currently the basic implementation is 38.3kB uncompressed and about 7kB compressed.
A big issue that I have with the implementation is that it promotes the use of the window onload event as a means of knowing when the DOM is loaded and ready. A better solution has been available since June 2006. There is no reason to use window.onload to wait to do DOM traversal. (There are good reasons to wait for window.onload – but they mostly have to do with images loading.)
In the case of the Hub they make two critical mistakes: They force libraries to wait to do DOM traversing until after the full page has loaded (a deprecated, slow, and obtrusive technique) and they promote the use of vendor-specific event listeners over defined ones. For example:
var enclosedFunc = function(){ return funcOrName.apply(scope, arguments); }; if(window["attachEvent"]){ window.attachEvent("on"+type, enclosedFunc); } else if(window["addEventListener"]){ window.addEventListener(type, enclosedFunc, false); } else if(document["addEventListener"]){ document.addEventListener(type, enclosedFunc, false); }
A minor point about this piece of code is that it promotes the use of Internet Explorer’s attachEvent over the standard addEventListener. Additionally, all event object information is lost in the process (in IE) as the global event object is not passed to the original function. Both of which are frowned upon: The first because it’s not forward-looking to the day when browsers will support the W3C (or in Opera’s case, enforcing it’s use of IE’s specific methods), the second because there’s a serious loss of event information in the process that is not corrected.
The second, mis-guided, part of the Hub’s implementation is that of the “Markup Scanner”. The goal of the scanner is to, effectively, parse the document once and notify individual libraries when their corresponding markup appears. (For example, I could request to be notified whenever an element in a specific namespace appears in the document – or when an element with a specific attribute is available.)
Throwing standards to the wind, they struck out and decided to build their own selection standards for matching markup. Not only that, but their implementation is mind-bendingly slow. Here’s a small snippet from the scanner code:
var childNode, i = 0, childNodes = node.childNodes; while(childNode = childNodes[i++]){ if (childNode.nodeType!=1) continue; OpenAjax.scanNode(childNode); }
I fear for the corporation who places this on their site, causing a horrible flash of un-JavaScript-enhanced content combined with a freezing-of-the-browser as the scanner attempts to traverse a 10,000 element page.
There are, at least, three very-fast implementations of JavaScript CSS Selector engines that are each capable of tearing through a document in a matter of milliseconds. I highly recommend that the alliance look to one of them to solve this matter.
What irks me the most about this Markup Scanner, and the whole OpenAjax Hub, is the fact that they’re deeming their code to be “the” code to standardize upon. In order for it to be a standard piece of code it must, at the very least, be:
- Free of bugs (and, by extension, easy to maintain).
- Mind-bendingly fast.
- Incredibly small.
Currently, the only requirement that the library meets is that it’s comparatively small (compressed). However, that’s 7kB of code that does nothing but make your library place nice with other libraries.
In my opinion, the OpenAjax hub could be reduced to a number of simple requirements:
- Use DOM event listeners in your code.
- Use a DOM Ready implementation to avoid using window.onload
- Use simple DOM queries to locate your pieces of markup (getElementsByTagName).
- Never overwrite any global variables.
- Keep your code confined to a single, global, namespace.
This would allow all libraries to live peacefully together, perform very quickly, and not require a single byte of overhead code. (Granted, if all libraries used a single DOM Ready implementation, perhaps that would be more cost-worthy.)
In short: The OpenAjax Alliance needs to seriously consider opening up their process to all Open Source JavaScript Libraries, helping to make their standards more practical and effective. Additionally, the OpenAjax Hub should be severely downsized, and reconsidered, if not removed entirely, as its addition serves little practical benefits (that a set of requirements couldn’t solve).
Update: I forgot to mention that a number of JavaScript notables, and jQuery users, have already chimed in on the “jQuery is OpenAjax Compliant” blog post. The post on this blog is a follow-up to that.
Sebastian (February 22, 2007 at 5:06 am)
John,
thank you for sharing your thoughts.
After reading this I’m sure I won’t use this OpenAjax stuff (even the name is incredibly stupid).
“Corporate theory” (and inability) should never dictate us. Instead I continue to count on grassroots development towards usable and pragmatic standards.
Thank you!
Sebastian
Jörn Zaefferer (February 22, 2007 at 9:22 am)
Thanks for investigating the terms and code in such detail. I never beared to look in more detail at one of both, therefore failing to understand what it’s all about.
At least the feeling that it not much more then some corporate-driven fuzz, missing the knowledge of any JavaScript/DOM expert, is now affirmed.
I wonder if they care…
Owan Hunte (February 22, 2007 at 10:30 am)
Hey John,
I’m with Sebastian on this. Your thoughts on the OpenAjax “initiative” are very insightful and really helps provide some food for thought. Sebastian I don’t know if you actually took a thorough look at any of the OpenAjax white papers or the OpenAjax Hub. I did and, like John’s impression of it, so much of it just irks the heck outta me.
On the jQuery blog someone posts a comment saying that it’s like trying to fix something that isn’t broken. I have to agree. I see no need real benefits of the approach being taken by this “initiative”. Quite frankly there’s been a great deal of time, energy and work spent by many of the Open Source JavaScript Libraries (jQuery, script.aculo.us, YUI, etc.) so far to do just what the OpenAjax Alliance claims to be its main objective, that of providing for seamless interoperability among different AJAX/JavaScript libraries.
John I don’t know if you feeling the same level of irritation I get from this Alliance’s goals but to me, it’s like trying to re-invent the wheel as a square-shaped wheel. They talk about first-generation AJAX libraries assuming their use would be in isolation of any other library/framework but all the open source libraries I’ve used so far (jQuery, YUI and script.aculo.us) took the “initiative” long before the formation of this alliance. They are each well designed libraries that already provide support in some way for interoperable use. They each exist in their own namespace, they do NOT pollute the top-level global namespace, and I could go on. Really I just don’t see the benefits here.
I’m not saying the intentions of the creators of the OpenAjax alliance may not have well-minded intentions but I can only see this becoming too bloated with coprporate influence and having more of a negative impact on the whole Open Source initiative.
Dan Atkinson (February 23, 2007 at 4:13 am)
That’s a good analysis of the OpenAjax Alliance from an individuals perspective. It seems that this alliance is almost bullying out loose open-source libraries in favour of ones with corporate backing.
Once again, this seems like a case of the corporations stamping on the face of entrepreneurial individuals such as yourself.
It might be worth having a look at taking jQuery further as a legal entity, thought the expense just doesn’t seem to be there.
Brad Neuberg (February 26, 2007 at 9:05 am)
Did anyone try to actually get a statement from someone at the OpenAjax Alliance? I appreciate this indepth analysis, but until someone actually sees what they have to say it all sounds like opinion and hearsay, which is dangerous. The OpenAjax Alliance deserves to be able to provide a refutation of your claims.
Note: I am in no way associated with the OpenAjax Alliance.
Best,
Brad
John Resig (February 26, 2007 at 10:22 am)
@Brad – Nope, I didn’t attempt to get a statement from them; these are just my personal thoughts on the OpenAjax Alliance and its codebase.
So, yes, it is absolutely opinion – hearsay, however, absolutely not. If I posted that “I heard from a friend that the OpenAjax Alliance was giving up on Ajax and moving to Flash”, then that’d be hearsay. Everything that I posted I researched thoroughly and discussed over with a number of JavaScript programmers. Most people have never even heard of the Alliance before, so I just wanted to talk about the results of some of my research.
“Note: I am in no way associated with the OpenAjax Alliance.” – That’s not entirely true – you’re part of the Dojo project, which is part of the Dojo Foundation, which is part of the OpenAjax Alliance. Just like I work for Mozilla which is also part of the Alliance. So, yes, you and I don’t actually have any direct input into the process, but we could (theoretically) influence it.
(btw – I love your work, keep it up! It’s all the rage over here at Mozilla too.)
Dylan Schiemann (February 26, 2007 at 10:57 am)
@Jörn: “At least the feeling that it not much more then some corporate-driven fuzz, missing the knowledge of any JavaScript/DOM expert, is now affirmed.”
Alex of Dojo and SitePen, and Luke from Tibco certainly dispel that theory. I don’t know if they would yet consider the hub anywhere near their finest work, but I know that developing something like this by committee is a different kind of challenge.
@John: Dojo has many of the same concerns as you about the hub, especially the markup scanner in its current form. I know that Dojo has not yet implemented the hub, as we are also pushing back on the same points you make.
Legal entity or not, I’m sure OpenAjax would find a way for jQuery, Prototype, or any other well-known JS toolkit to join if they were interested. That may be a big if…
If you want to know the story of why we bothered to setup a legal entity for Dojo, or why we joined OpenAjax, feel free to contact Alex or me and we’ll share our pros and cons.
John Resig (February 26, 2007 at 11:12 am)
@Dylan – Thanks for stopping by. It’s good to hear that many of my concerns are not alone.
“Legal entity or not, I’m sure OpenAjax would find a way for jQuery, Prototype, or any other well-known JS toolkit to join if they were interested. That may be a big if…”
jQuery is definitely interested. If all I did was complain from afar, that wouldn’t do anyone any good; that’s why I implemented the OpenAjax Hub in jQuery before even making this blog post. I earned myself the right to complain a little bit ;-)
I’ll absolutely contact you guys off-blog, I have plenty of questions.
Brad Neuberg (February 26, 2007 at 12:24 pm)
@John: I’m a huge fan of your work too ;)
Best,
Brad
Ric (February 26, 2007 at 12:31 pm)
John,
In some ways, the Alliance is a good thing: it gets the corps together to try to agree to _some_ standard. They have the gold, so they make the rules.
However, I also am concerned they are a committee and are trying to please too many people – all the frameworks supported by these companies are so different! And most of them are not what I would call “Open”.
A while back, when I donated the domain “OpenAjax.Org” to the Alliance, Jon Ferraiolo promised me a membership, but I never took him up on it. If you want, I can contact him to put jQuery in.
On the other hand, if that does not work out or you believe you can do better, I still own “OpenAjax.Com” that I can let you use as part of OpenDomain. (see our press release for more detail)
Ric
Jon Ferraiolo (February 26, 2007 at 1:49 pm)
I just noticed this thread. Sorry for not responding sooner.
OpenAjax Alliance definitely wants all of the major Ajax toolkit developers to join the effort. The comments in this thread point out shortcomings with our current policy statement about individuals who are involved with certain open source projects for which there is no “entity”. My expectation is that the OpenAjax members will agree that that it makes sense to modify this policy statement to make it easier for key contributors within the Ajax community to join the OpenAjax effort and help us do the right thing for the community.
With regard to John Resig’s comments about the OpenAjax Hub, and how most Ajax toolkits already are well-behaved, actually I agree with much of what he says. For many scenarios, the OpenAjax Hub and the OpenAjax Registry are not critical requirements because in many scenarios things are not broken. However, sometimes different toolkits do indeed collide and often different toolkits do not interoperate sufficiently (there is no standard way to listen/respond to each other’s published events in mashup scenarios). Furthermore, as the industry matures, developers want Ajax component integration with IDEs and server frameworks (PHP, Java, .NET, etc.), two other areas that OpenAjax Alliance is pursuing. The Hub makes more sense in the context of a bigger picture that includes mashups, IDEs and server frameworks.
In terms of John’s review comments about the existing implementation of the Hub, two reactions: (1) Our open source project is meant to be simply a reference implementation, not the only implementation. Our goal is that many leading Ajax toolkits will provide their own implementation of the Hub in accordance with the specification and that those implementations will be optimized to meet their particular requirements, (2) Our existing open source project is still under development and will be improved over time, and therefore we appreciate all feedback on shortcomings and suggestions for improvement. In particular, we will look at John’s suggestions closely. (Lots more to discuss relative to John’s feedback, but if we dive into each of John’s comments individually, this thread will grow quite large.)
Regarding the size of the Hub as it exists today, we are working to make it smaller. The markup scanner is about half of the current footprint and does not have to be included if nothing on the current Web page uses it.
I greatly appreciate the depth of review and insightful comments by John. John, please send an email to [email protected] so that we can start discussion about having you join the Alliance as an individual. For other individuals who want to join, also please send me an email. If people have contact information for the leaders of other Ajax open source projects who are not yet in OpenAjax Alliance, please send that contact information to me and I will send an invitation to those people.
Finally, let me state publicly OpenAjax Alliance’s great gratitude to Ric Johnson and OpenDomain.org for donating the http://www.openajax.org domain to OpenAjax Alliance.
Jon Ferraiolo
Ric (February 26, 2007 at 2:28 pm)
Dear Jon Ferraiolo,
Thanks for the kudos! I gave the domain to you for a reason, and you have shown you were the right person to carry the torch.
You have done a great job, except I felt left out as an independent developer. I was not going to say anything because I know how long these committees take, but when I read this blog, I thought I should to put in my comment.
Thank you for your insightful response – I hope it will turn some of the other people back on to OpenAjax Alliance.
Ric
Kevin Hakman (February 26, 2007 at 6:49 pm)
We at TIBCO have found good success with the OpenAjax Hub demonstrating interop with the GI ajax library, DWR, Dojo and others. We mostly use the pub/sub interfaces of the hub and do not rely upon the window.onload (which is NOT actually required to be OAA conformant though the current implementation uses it), and we also do not rely upon the mark-up scanner (waiting for that to improve too). The OAA Hub is modularized so that you can get just the core, or the core + the scanner (which also meets the aim of making it smaller).
Chuck Allen (February 27, 2007 at 1:48 pm)
John,
Consortia membership agreements are always awful things to read. I am not a lawyer, but I do have a lot of experience with these agreements. The OpenAjax membership agreement only mentions “compliant” in defining “covered products”. This is only in context of contributors agreeing not to assert “Cover Claims” (patents) against “Covered Products” — i.e., products that implement the OpenAjax specifications.
It sounds to me like you aren’t the kind of guy who goes around suing very many people to enforce your patent portfolio. Likewise, I’m sure you don’t want to be sued by anyone trying to assert a patent claim on something you implemented and assumed was free and clear of royalties. I don’t think you should really have a problem with the OpenAjax membership agreement. Unfortunately, patent trolls are a real problem and can wreck collective efforts or at least be a costly nuisance ( consider http://www.boycottblackboard.org/ ).
To cut through the mumbo jumbo – all the agreement is saying is that if you join OpenAjax and you make contributions for which you have patents and those contributions end up part as part of the OpenAjax specification, you agree to grant a royalty-free license and not to sue people/organizations who have create products/code based on the specification.
Andrew Dupont (March 1, 2007 at 12:51 am)
I wouldn’t be opposed to Prototype joining the OpenAjax Alliance, though obviously that’s Sam’s call. But whether they’d have us to begin with is another issue.
I wonder if the Alliance would be OK with the “shallow namespacing” that Prototype does — we don’t dump all our methods into the global namespace, but then we don’t limit ourselves to one root object either. Prototype and Mootools (which is a fork/offshoot of Prototype) are the only two major JS libraries that take this approach.
That said: based on what I’ve been told about OpenAjax and what I’ve read in this post, it seems like an awful lot of bureaucracy, structure, and process for what amounts to a handful of play-nice guidelines and 7K of code. I’m sure they do more than come up with standards, but these guys are hardly the W3C.
Frank Nimphius (March 1, 2007 at 11:32 am)
“Instead I continue to count on grassroots development towards usable and pragmatic standards.”
And exactly this attitude is what brings us into the situation of incompatibility and isolated solution. Why not joining in and be a part of a “one voice” that is loud enough to make a change instead of being negative – which is too easy to be.
Frank
Jon Ferraiolo (March 2, 2007 at 1:31 am)
Responding to Andrew’s question “whether they’d have us to begin with”, the answer is most definitely yes. OpenAjax Alliance definitely wants people from Prototype in OpenAjax. In terms of Prototype not restricting itself to one root object, let’s have a dialog about it. I am personally in favor of finding a way to make multi-toolkit mashups work while retaining Prototype’s current approach, but finding such a solution will be a whole lot easier if we problem-solve together.
NBA (September 19, 2007 at 6:07 am)
That’s a good analysis of the OpenAjax Alliance from an individuals perspective. It seems that this alliance is almost bullying out loose open-source libraries in favour of ones with corporate backing.
[email protected] (September 27, 2007 at 6:38 am)
ijpdah dywpuebx wfbptkqh urztij mklpxg awxvinjt fevxz