JavaScript, Ajax and the DOM

The resur­gence of the use of JavaScript, and the increased level of sophis­ti­ca­tion in its employ­ment on the web is noth­ing short of spec­tac­u­lar. After an early surge of enthu­si­asm in the mid to late 1990s, JavaScript remained largely con­fined to effects and gim­micks, until the rise of Ajax and var­i­ous libraries and frame­works. That the major­ity of our respon­dents con­sider them­selves “devel­op­ers” not “design­ers” is tes­ti­mony to how impor­tant JavaScript and Ajax have become.

In this sec­tion, we tried to get an under­stand­ing of the extent to which respon­dents used JavaScript (if at all), and how they used JavaScript.

Do they use JavaScript?

In response to the ques­tion “Do you use JavaScript in your devel­op­ment?”, only 5% replied no. 73% replied that they use it for visual effects, 61% for form val­i­da­tion, 42% for com­plex appli­ca­tion inter­ac­tion, and over half for Ajaxian com­mu­ni­ca­tion between client and server (respon­dents could give mul­ti­ple answers).

Both the over­all per­cent­age of JavaScript users (95%), and the level of sophis­ti­ca­tion they are using the lan­guage for reflect not only the promi­nence of JavaScript as part of these respon­dents tools, but also the nature of web devel­op­ment gen­er­ally today. The days of the sta­tic page based web site are def­i­nitely on the way out, and the day of the web appli­ca­tion is on the rise.

Do you use JavaScript in your development?
AnswerCountPercentage
No655.27%
For visual effects90273.10%
For form validation75461.10%
For com­plex appli­ca­tion interaction52042.14%
For Ajax com­mu­ni­ca­tion with the server65953.40%

JavaScript Use

We fol­lowed up with some ques­tions about devel­op­ers’ method­olo­gies when it comes to using JavaScript.

JavaScript cod­ing practices

First up, we asked “Do you sep­a­rate your JavaScript from your markup (“unob­tru­sive JavaScript”)?”, a rec­om­mended prac­tice. Just under 4% of devel­op­ers said no, while 39% said always, and 42% said usu­ally. It’s clear that respon­dents are at least on the whole aware of this rec­om­mended practice.

Do you sep­a­rate your JavaScript from your markup?
AnswerCountPercentage
Always47738.65%
Usually51841.98%
No473.81%
No answer826.65%
Non com­pleted1108.91%

We also asked “Do you strictly adhere to the W3C DOM, and avoid browser spe­cific exten­sions?”. Again only around 4% answered in the neg­a­tive, while half answered “as much as pos­si­ble”, and just under a third “always”.

Only about 9% of respon­dents answered the fol­low up ques­tion “What non W3C DOM meth­ods or prop­er­ties do you use reg­u­larly?” Unsurprisingly, innerHTML tops the list at around 40% of these respon­dents. At about 7% is xmlHttpRequest. The lat­ter is cur­rently a draft spec­i­fi­ca­tion from the W3C, while innerHTML is a pro­posed addi­tion to HTML 5. About 17% of these respon­dents specif­i­cally men­tioned work­ing around Internet Explorer bugs, or lack of sup­port of aspects of the W3 DOM. Like all the other ques­tions which asked for fur­ther infor­ma­tion from respon­dents, the full responses are avail­able in the CSV of the sur­vey results.

Do you strictly adhere to the W3C DOM, and avoid browser spe­cific extensions?
AnswerCountPercentage
Yes37530.39%
As much as possible61349.68%
No534.29%
No answer836.73%
Non com­pleted1108.91%
Libraries and Frameworks

The resur­gence of the use of JavaScript has gone hand in hand with the rise of robust, sophis­ti­cated JavaScript libraries like JQuery, Dojo and YUI. To get a sense of whether devel­op­ers are using these libraries, and which ones, we asked “Which JavaScript libraries and frame­works do you use?”, with options for a dozen of the most well known libraries, and the option too of list­ing other libraries used.

10% of respon­dents replied that they used no libraries, sug­gest­ing that as many as 95% of devel­op­ers who use JavaScript use libraries to some extent.

In terms of which libraries were used (respon­dents could list more than one library), JQuery dom­i­nates among these respon­dents, with 63% of devel­op­ers answer­ing that they use it. Other com­monly used libraries include Prototype at 23%, Mootools at 19%, Script​.aculo​.us at 18%, and YUI at 11%. In this sur­vey, no other library gained a share of more than 3%.

Of the “other” libraries used (a total of just on 4% of respon­dents answered other), only Adobe’s Spry, with a total of 11, or about 1%, had any non triv­ial num­ber of respondents.

Which JavaScript libraries and frame­works do you use?
AnswerCountPercentage
None1199.64%
Backbase20.16%
Dojo362.92%
Ext332.67%
GWT161.30%
JQuery77562.80%
Mootools23519.04%
Prototype28723.26%
qoox­doo10.08%
script​.aculo​.us22418.15%
YUI13310.78%
Other504.05%

JavaScript library market share

It’s clear that in just a few short years, JavaScript has gone from some­thing used spar­ingly to add a lit­tle inter­ac­tion or some effects to sites, to a key tech­nol­ogy for web professionals.

Next

Next we’ll take a look at how respon­dents use embed­ded con­tent like Flash and Silverlight which require browser plug-​​ins.