JavaScript, Ajax and the DOM

The resurgence of the use of JavaScript, and the increased level of sophistication in its employment on the web is nothing short of spectacular. After an early surge of enthusiasm in the mid to late 1990s, JavaScript remained largely confined to effects and gimmicks, until the rise of Ajax and various libraries and frameworks. That the majority of our respondents consider themselves “developers” not “designers” is testimony to how important JavaScript and Ajax have become.

In this section, we tried to get an understanding of the extent to which respondents used JavaScript (if at all), and how they used JavaScript.

Do they use JavaScript?

In response to the question “Do you use JavaScript in your development?”, only 5% replied no. 73% replied that they use it for visual effects, 61% for form validation, 42% for complex application interaction, and over half for Ajaxian communication between client and server (respondents could give multiple answers).

Both the overall percentage of JavaScript users (95%), and the level of sophistication they are using the language for reflect not only the prominence of JavaScript as part of these respondents tools, but also the nature of web development generally today. The days of the static page based web site are definitely on the way out, and the day of the web application is on the rise.

Do you use JavaScript in your development?
Answer Count Percentage
No 65 5.27%
For visual effects 902 73.10%
For form validation 754 61.10%
For complex application interaction 520 42.14%
For Ajax communication with the server 659 53.40%

JavaScript Use

We followed up with some questions about developers’ methodologies when it comes to using JavaScript.

JavaScript coding practices

First up, we asked “Do you separate your JavaScript from your markup (“unobtrusive JavaScript”)?”, a recommended practice. Just under 4% of developers said no, while 39% said always, and 42% said usually. It’s clear that respondents are at least on the whole aware of this recommended practice.

Do you separate your JavaScript from your markup?
Answer Count Percentage
Always 477 38.65%
Usually 518 41.98%
No 47 3.81%
No answer 82 6.65%
Non completed 110 8.91%

We also asked “Do you strictly adhere to the W3C DOM, and avoid browser specific extensions?”. Again only around 4% answered in the negative, while half answered “as much as possible”, and just under a third “always”.

Only about 9% of respondents answered the follow up question “What non W3C DOM methods or properties do you use regularly?” Unsurprisingly, innerHTML tops the list at around 40% of these respondents. At about 7% is xmlHttpRequest. The latter is currently a draft specification from the W3C, while innerHTML is a proposed addition to HTML 5. About 17% of these respondents specifically mentioned working around Internet Explorer bugs, or lack of support of aspects of the W3 DOM. Like all the other questions which asked for further information from respondents, the full responses are available in the CSV of the survey results.

Do you strictly adhere to the W3C DOM, and avoid browser specific extensions?
Answer Count Percentage
Yes 375 30.39%
As much as possible 613 49.68%
No 53 4.29%
No answer 83 6.73%
Non completed 110 8.91%
Libraries and Frameworks

The resurgence of the use of JavaScript has gone hand in hand with the rise of robust, sophisticated JavaScript libraries like JQuery, Dojo and YUI. To get a sense of whether developers are using these libraries, and which ones, we asked “Which JavaScript libraries and frameworks do you use?”, with options for a dozen of the most well known libraries, and the option too of listing other libraries used.

10% of respondents replied that they used no libraries, suggesting that as many as 95% of developers who use JavaScript use libraries to some extent.

In terms of which libraries were used (respondents could list more than one library), JQuery dominates among these respondents, with 63% of developers answering that they use it. Other commonly used libraries include Prototype at 23%, Mootools at 19%, Script​.aculo​.us at 18%, and YUI at 11%. In this survey, no other library gained a share of more than 3%.

Of the “other” libraries used (a total of just on 4% of respondents answered other), only Adobe’s Spry, with a total of 11, or about 1%, had any non trivial number of respondents.

Which JavaScript libraries and frameworks do you use?
Answer Count Percentage
None 119 9.64%
Backbase 2 0.16%
Dojo 36 2.92%
Ext 33 2.67%
GWT 16 1.30%
JQuery 775 62.80%
Mootools 235 19.04%
Prototype 287 23.26%
qooxdoo 1 0.08%
script​.aculo​.us 224 18.15%
YUI 133 10.78%
Other 50 4.05%

JavaScript library market share

It’s clear that in just a few short years, JavaScript has gone from something used sparingly to add a little interaction or some effects to sites, to a key technology for web professionals.

Next

Next we’ll take a look at how respondents use embedded content like Flash and Silverlight which require browser plug-​​ins.