JavaScript, Ajax and the DOM

In the introduction to this section of our report last year, we made the following observations, which are only reinforced by this year’s survey.

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 4% (last survey 5.3%) replied no. 77% (up from 73%) replied that they use it for visual effects, 66% (61%) for form validation, 48% (42%) for complex application interaction, and 58% (53%) for “Ajaxian communication between client and server” (respondents could give multiple answers).

Both the overall percentage of JavaScript users (96%), 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.

Question 35: Do you use JavaScript in your development?

2010
Answer Count %
No 56 3.99%
For visual effects 1077 76.82%
For form validation 926 66.05%
For complex application interaction 683 48.72%
For Ajax communication with the server 818 58.35%
2008
Answer Count %
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%
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, Prototype and YUI. To get a sense of whether developers are using these libraries, and which ones, we once again 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.

The big stories here are

  • the small number of respondents who use no library (down from 9.6% to only 3.9% in this survey — effectively all our respondents use JavaScript, and all those who do use one or more libraries)
  • JQuery, already dominant last year with 63% of all respondents using it has increased strongly to a 78% adoption rate by respondents.
  • Of the other libraries, only YUI (11.5% from 10.8%), and Ext (2.8% up from 2.7%) saw an increase in percentage use by respondents, Dojo stayed steady at 2.9%, and all others fell
  • Despite these changes, the ranking from most used to least used stayed essentially unchanged

Which JavaScript libraries and frameworks do you use?

2010
Framework Count %
None 55 3.92%
Backbase 1 0.07%
Dojo 41 2.92%
Ext 39 2.78%
GWT 13 0.93%
JQuery 1091 77.82%
Mootools 196 13.98%
Prototype 249 17.76%
qooxdoo 2 0.14%
script​.aculo​.us 187 13.34%
YUI 161 11.48%
Other 43 3.07%
2008
Framework Count %
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%

In addition to choosing from a list of th emost common libraries, we gave respondents the opportunity to name other libraries they use. Interestingly, despite gaining considerable coverage in the last year or so, the fully fledged application development focussed libraries Cappucino and Sproutcore each only were mentioned once. These libraries are much more geared toward desktop-​​like applications in the browser than more “low level” libraries like most of those listed above. It remains to be seen whether in subsequent surveys use of these libraries increases, or whether developers aren’t particularly interested in building desktop-​​like applications for the web.

HTML 5

Since our 2008 survey, HTML5 has gone from a promising, atalked about technology, to having quite wide support of various features in several contemporary browsers. It’s particularly well adopted in the browsers on mobile devices like the iPhone, and Android. To get a sense of how much the API features, as opposed to markup features of HTML5 are being used, we asked a couple of questions regarding their use in this year’s survey. Note to the pedants that we are aware that some of these APIs are not technically part of HTML5, and others have never been so, but we use HTML5 here as an umbrella term for new, browser based technologies.

Only fewer than 10% of our respondents say that they are working with these APIs. However, given their still limited support, and their only recent availability, that they have similar levels of adoption to SVG and Canvas is notable.

Of those APIs developers mentioned using, a little under a half (45%) use geolocation APIs, around a third (31%) client side storage, while web workers, websockets, drag and drop and the file API all are mentioned by a handful of developers at most.

Geolocation and client side storage are particularly relevant to mobile devices, so as we see mobile web use increase, and an increasing focus on optimizing for or targetting the mobile web user, we’d expect to see the use of those two technologies in particular grow strongly.

Do you use HTML5 APIs (geolocation, client side storage, webworkers etc)?

2010
Answer Count %
Yes 128 9.13%
No 1121 79.96%

If so, which APIs do you use

2010
API Count %
geolocation 57 45%
client side storage 40 31%
web workers 4 3%
drag and drop 3 2.3%
file api 2 1.6%
websockets 2 1.6%
JavaScript coding practices

Like last year, we also asked some questions about developers’ scripting methodologies.

Do you separate your JavaScript from your markup (“unobtrusive JavaScript”)?

Unlike the message of separating presentation from markup, developers are somewhat less likely to practice “unobtrusive JavaScript”, with similar numbers this year when it came to that question.

2010
Answer Count %
Always 614 43.79%
Usually 529 37.73%
No 56 3.99%
2008
Answer Count %
Always 477 38.65%
Usually 518 41.98%
No 47 3.81%

Developers also continue to adhere largely to the W3C DOM where possible, but the realities of different DOMs in different browsers mean most respondents take a pragmatic approach to this issue.

Do you strictly adhere to the W3C DOM, and avoid browser specific extensions?

2010
Answer Count %
Yes 454 32.38%
As much as possible 664 47.36%
No 81 5.78%
2008
Answer Count %
Yes 375 30.39%
As much as possible 613 49.68%
No 53 4.29%

Last year we were surprised at the extent to which respondents were using JavaScript and JavaScript libraries in their work.

While the percentage of respondents using them trails that using HTML5 markup, there’s still an impressive takeup of at least some aspects of HTML5 APIs, given how recent and still evolving these technologies are.

Next

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