- From: Léonie Watson <lwatson@paciellogroup.com>
- Date: Thu, 26 Mar 2015 11:53:04 -0000
- To: "'WAI Protocols & Formats'" <public-pfwg@w3.org>
- Cc: "'Ian Pouncey'" <ian@ipouncey.co.uk>
- Message-ID: <024501d067bb$6bc5ba10$43512e30$@paciellogroup.com>
Hello, There has been some discussion about whether we should use jQuery or vanilla JavaScript for the APG 1.1 examples. On the TF call of 2nd February it was decided we should use jQuery, however neither of the draft examples we have so far use a JavaScript library at all. This seems like a good opportunity to revisit the discussion. TLDR: I think there’s a good case to be made for using vanilla JavaScript and not a JavaScript library for the APG examples. jQuery (and other JavaScript libraries) have two main purposes: 1. Fix cross-browser JavaScript inconsistencies. 2. Provide easy access to features that are complicated to write in JavaScript. Since IE9 the number of cross-browser inconsistencies has reduced dramatically, and many features of jQuery are now features of JavaScript. For example, the following things are effectively equivalent: // jQuery var getThings = $('#id .class element'); and // JavaScript var getThings = document.getQuerySelectorAll('#id .class element'); More examples are available here: http://youmightnotneedjquery.com/ The use of JavaScript libraries is in decline. jQuery remains the most popular library in use, but with each new version numbers are diminishing. Of the 50 million sites using jQuery, only 1.5 million use jQuery 1.9.x, and 250,000 use jQuery 2.x. jQuery 2.x is used on fewer sites than MooTools, Script.Aculo.us (last updated in 2010), Prototype, and YUI (no longer actively maintained) [2]. Several notable websites do not use jQuery (including Facebook, Wikipedia, YouTube and Yahoo!). Nearly 34% of websites use no large JavaScript library at all [3]. Example JavaScript (vanilla) can be used in any context (whether a framework is being used to build an application or not). This means examples written in JavaScript can be used by anyone. Using vanilla JavaScript will also make it easier for people to learn the fundamentals of accessible widget functionality. It might be a little more verbose to read/write, but it isn’t abstracted into a library – and there is no requirement for anyone to learn a particular library in order to understand the examples either. So in order to maximise usefulness, not place learning overheads on developers, and in light of the general trend towards no libraries, I think we should look again at using vanilla JavaScript for the APG 1.1 examples. Léonie. [1] https://www.w3.org/2015/02/02-aria-apg-minutes.html [2] http://trends.builtwith.com/javascript/javascript-library [3] http://w3techs.com/technologies/history_overview/javascript_library/all -- Léonie Watson Senior accessibility engineer, TPG @LeonieWatson @PacielloGroup PacielloGroup.com
Received on Thursday, 26 March 2015 11:53:25 UTC