JavaScript Library Overview

jeresig
JavaScript Libraries
  Ajax Experience - October 2007

      John Resig (ejohn.org)
Question: How do you want
   to write JavaScript?
1) Plug-and-Play

• Drop in a “calendar widget” or “tabbed
  navigation”
• Little, to no, JavaScript experience required.
• Just customize some options and go.
• No flexibility.
2) Some Assembly
         Required
• Write common utilities
 • Click a link, load a page via Ajax
 • Build a dynamic menu
 • Creating interactive forms
• Use pre-made code to distance yourself
  from browser bugs.
• Flexible, until you hit a browser bug.
3) Down-and-Dirty

• Write all JavaScript code from scratch
• Deal, directly, with browser bugs
• Quirksmode is your lifeline
• Excessively flexible, to the point of
  hinderance.
What we’ve just seen...

• Widgets
• Libraries
• Raw JavaScript
What we’ve just seen...

• Widgets
• Libraries
• Raw JavaScript
Why use a library?

• Makes JavaScript bearable
• Gets the job done fast
• Simplifies cross-browser support
• Sort of like C stdlib - no one just codes all
  of C by hand
What kind of libraries exist?
          Open Source   Commercial
                           Atlas
Client/    AjaxCFC
                        Backbase for
Server      Qcodo
                           Struts

           Prototype
Browser     jQuery       Backbase
 Only      Yahoo UI     SmartClient
             Dojo
What kind of libraries exist?
          Open Source   Commercial
                           Atlas
Client/    AjaxCFC
                        Backbase for
Server      Qcodo
                           Struts

           Prototype
Browser     jQuery       Backbase
 Only      Yahoo UI     SmartClient
             Dojo
Open Source Libraries
          Browser Only    Client/Server
          Scriptaculous
 Task                       AjaxCFC
             moo.fx
Specific                      Qcodo
           Open Rico

           Prototype
General     jQuery        Ruby on Rails
Purpose    Yahoo UI        CakePHP
             Dojo
Open Source Libraries
          Browser Only    Client/Server
          Scriptaculous
 Task                       AjaxCFC
             moo.fx
Specific                      Qcodo
           Open Rico

           Prototype
General     jQuery        Ruby on Rails
Purpose    Yahoo UI        CakePHP
             Dojo
Why these libraries?
Ajaxian Survey
Prototype         jQuery   Yahoo UI                       Dojo




            20%

                           35%

        21%


                     25%
                                      http://ajaxian.com/archives/ajaxian-2007-survey-results
Google Trends

                                                                                            Prototype
                                                                                            jQuery
                                                                                            Dojo
                                                                                            Yahoo UI



http://google.com/trends?q=prototype+javascript%2C+jquery+javascript%2C+yui+javascript%2C+dojo+javascript&ctab=0&geo=all&date=all&sort=0
The Libraries
Prototype
Prototype: Overview

• Started early 2005 by Sam Stephenson
• Incredibly popular, tied with Ruby on Rails’
  popularity
• Development backed by 37 Signals
Prototype: Focus

• Improving the usability of the JavaScript
  language
• Big emphasis on adding in ‘missing’
  JavaScript features
• Clean structure, clean objects and ‘classes’
Prototype: Details

• Code quality is fantastic, great features
• All animations (and interactions) are in
  Scriptaculous
• Updated frequently
• Looking at Prototype 1.6.0
jQuery
jQuery: Overview

• Released January 2006 by John Resig
• Rapid rise in popularity
• Many developers across the globe
jQuery: Focus

• Improving the interaction between
  JavaScript and HTML
• Finding elements then performing actions
• Highly-effective, short, code
jQuery: Details

• Core features are limited to DOM, Events,
  Effects, Ajax
• Other features can be added in via plugins
• Looking at jQuery 1.2.1
Yahoo! UI
YUI: Overview

• Released Feb 2006 by Yahoo!
• Maintained and financed internally
• Attempt to standardize internal JavaScript
YUI: Focus

• Exposing, and solving, common
  methodologies
• Looking for common idioms (Drag-and-
  Drop, Calendar, Auto-Complete)
• Looking at Yahoo UI 2.3.1
Dojo
Dojo: Overview

• Started early 2005 by Alex Russell + Co.
• Large development community
• Lots of corporate backing (IBM, AOL)
• Big code base, tons of features
Dojo: Focus
• Building complete web applications
• A package heirarchy, e.g.:
  dojo.addClass( ... )
• Focus has transcended into widgets (Dijit)
• Huge number of features
• Today we’re looking at Dojo 0.9
What should a library have?
Code Base
• Core Functionality
 • DOM
 • Events
 • Ajax
 • Animations
• User Interface Widgets
Development

• Good Architecture
• Open Licensing
• Wide Browser Support
• Small File Size
Project

• Development Team (Open, Funded)
• Code in SVN / Bug Tracker
• Good Unit Test Coverage
Documentation

• Full API Coverage
• Plenty of Tutorials
• Some Books
• Wide variety of Demos
Community

• Active Mailing List / Forum
• Support and Training
• Popularity
Code Base
• Core Functionality
 • DOM
 • Events
 • Ajax
 • Animations
• User Interface Widgets
Core Functionality
• Bare minimum needed to make a dynamic
  “Ajax” web site:
 • DOM (Traversal and Manipulation)
 • Events
 • Ajax
 • Animations
DOM

• Traversal
 • Using CSS selectors to locate elements
• Modification
 • Create/remove/modify elements
 • Having a DOM builder is important
DOM Traversal

•   Prototype:
    $$(“table > tr”)

•   jQuery:
    $(“div > p:nth-child(odd)”)

•   Dojo:
    dojo.query(“table tr:nth-child(even)”)

•   Yahoo UI:
    No querying support
DOM Modification

•   Prototype:
    Insertion.Bottom(“list”,”<li>Another item</li>”);

•   jQuery:
    $(“#li”).append(“<li>An item</li>”);

•   Dojo and Yahoo UI have weak support - no DOM
    building capabilities, basic property modification
Events
•   Support for simple event binding/removal
•   Support for custom events is essential
•   Prototype:
    Event.observe(“button”,”click”, function(){
        alert(“Thanks for the click!”);
    });
•   jQuery:
    $(“div”).click(function(){
        alert(“div clicked”);
    });
Events (cont.)

•   Yahoo UI:
    YAHOO.util.Event.addEventListener(“list”, “click”, function(){
        alert(“List Clicked”);
    });

•   Dojo:
    dojo.connect(dojo.byId(quot;mylinkquot;), quot;clickquot;, function(){
        alert(“Link clicked”);
    });
Custom Events

• $(“#list”).bind(“drag”, function(){
     $(this).addClass(“dragged”);
  });
• $(“#test”).trigger(“drag”);
Ajax
•   Request and load remote documents

•   Prototype:
    new Ajax.Request(“test.html”, {
        method: “GET”,
        onComplete: function(res){
          $(‘results’).innerHTML = res.responseText;
        }
    });

•   jQuery:
    $(“#results”).load(“test.html”);
Ajax (cont.)
•   Yahoo UI
    YAHOO.util.Connect.asyncRequest(
       'GET', “test.html”, function(data){
         YAHOO.util.Dom.id(“results”).innerHTML = data;
       }
    );

•   Dojo
    dojo.io.bind({
      url: quot;test.htmlquot;,
      method: quot;getquot;,
      mimetype: quot;text/htmlquot;,
      load: function(type, data) {
        dojo.byId(“results”).innerHTML = data;
      }
    });
Ajax (cont.)
• jQuery is only one capable of doing DOM
  traversing over XML
• jQuery.get(“test.xml”, function(xml){
        $(“user”, xml).each(function(){
            $(“<li/>”).text( $(this).text() )
               .appendTo(“#userlist”);
        });
  });
Animations
• Simple animations (hide/show/toggle)
• Provide elegant transitions
• No animations in Prototype Core (see
  Scriptaculous, instead)
• jQuery:
  $(“#menu”).slideDown(“slow”);
Animations (cont.)

•   Yahoo UI:
    new YAHOO.util.Anim(“list”, { width: { from: 10, to: 100 } }, 1,
       YAHOO.util.Easing.easeOut
    );

•   Dojo:
    dojo.fadeOut({ node: dojo.byId(“list”), duration: 500 });
Core Feature Summary
            DOM Events   Anim.   Ajax

Prototype    X     X       -      X

 jQuery      X     X      X       X

Yahoo UI     /     X      X       X

  Dojo       /     X      X       X
User Interface Widgets
• ejohn.org <-- slides
• Difficult to implement components, made
  easy
• Commonly used, save duplication
• Some common components:
  Drag & Drop, Tree, Grid, Modal Dialog,
  Tabbed Pane, Menu / Toolbar, Datepicker,
  Slider
User Interface Packages

• Only looking at officially-supported code:
 • Prototype has Scriptaculous
 • jQuery has jQuery UI
 • Dojo has Dijit
 • Included in Yahoo UI
Drag & Drop


• Drag an item from one location and drop in
  an other
• Supported by all libraries
Tree

•   A navigable hierarchy
    (like a folder/file
    explorer)

•   In Dojo and Yahoo UI
Grid


• An advanced table (resizable, editable, easily
  navigable)
• In Dojo and Yahoo UI
Modal Dialog


• Display confined content (usually drag &
  droppable) and confirmation dialogs
• In Dojo,Yahoo UI, and jQuery
Tabbed Pane


• Multiple panes of content navigable by a
  series of tabs
• In Dojo,Yahoo UI, and jQuery
Menu / Toolbar


• A list of navigable items (with sub-menus)
• In Dojo and Yahoo UI
Datepicker

•   An input for selecting a
    date (or a range of
    dates)

•   In Dojo,Yahoo UI, and
    jQuery
Slider


• A draggable input for entering a general,
  numerical, value
• In all libraries
Tons More!
• Color Picker (Dojo,YUI)
• Layout (Dojo,YUI)
• Auto Complete (Dojo, Proto,YUI)
• Selectables (Proto, jQuery)
• Accordion (Dojo, jQuery)
• WYSIWYG (Dojo,YUI)
Themeing

• A consistent look-and-feel for widgets
• jQuery,Yahoo UI, and Dojo provide
  themeing capabilities
• jQuery’s and Yahoo UI’s are documented
Accessibility

• Taking in to consideration points from
  ARIA (Accessible Rich Internet
  Applications)
• Dojo is taking a solid lead, here
Development

• Good Architecture
• Open Licensing
• Wide Browser Support
• Small File Size
Architecture
• Bottom Up (Prototype, jQuery)
    vs. Top Down (Dojo,Yahoo UI)
• jQuery, Dojo, and Yahoo UI all use a single
  namespace
• Prototype extends native objects (high
  likelihood of inter-library conflict)
• jQuery is extensible with plugins
Licensing

• All use liberal licenses (“Keep my name on
  the file, don’t sue me.”)
• MIT:
  Prototype, jQuery
• BSD:
  Yahoo UI, Dojo
Browser Support

• Everyone supports:
  IE 6+, Firefox 2+, Safari 2+, Opera 9+
• Except:
 • Prototype doesn’t support Opera
 • Dojo is dropping support for Safari 2
File Size
 • Serving your JavaScript minified + Gzipped
 • Optimal level of compression and speed
 • Core file size (in KB):
35.00

26.25

17.50

 8.75

   0
        Prototype    jQuery   Yahoo UI   Dojo
Project

• Development Team (Open, Funded)
• Code in SVN / Bug Tracker
• Good Unit Test Coverage
Development Team

• Prototype, jQuery, and Dojo all have open
  development (anyone can contribute)
• jQuery,Yahoo UI, and Dojo all have paid,
  full-time, developers working on the code
• All have paid, part-time, developers
SVN / Bug Tracker

• Prototype, jQuery, and Dojo all have code
  in a public SVN repositor
• Yahoo UI’s development is private and is
  limited to Yahoo employees
• All libraries have a public bug tracker
Unit Tests

• All libraries have some automated unit
  tests
• jQuery,Yahoo UI, and Dojo all have public
  unit tests
• jQuery and Dojo have tests that can run in
  Rhino
Documentation

• Full API Coverage
• Plenty of Tutorials
• Some Books
• Wide variety of Demos
API Documentation

• Prototype, jQuery, and Yahoo UI all have full
  coverage
• jQuery provides runnable examples with
  each API item
• Dojo’s coverage is spotty - work in
  progress
Tutorials
• All libraries provide some tutorials
• jQuery and Yahoo UI have screencasts
• Prototype: 6
• jQuery: 68 (English)
• Yahoo UI: 32
• Dojo: 5
Books
• Prototype:
 •   Prototype and Scriptaculous in Action (Manning)

 •   Prototype and Scriptaculous (Pragmatic)

• jQuery:
 •   Learning jQuery (Packt)

 •   jQuery Reference Guide (Packt)

• Yahoo UI: None
• Dojo: A short online book
Demos

• Yahoo UI provides a considerable number
  of live demos and examples for all features
• jQuery provides live examples and a few
  demo applications
• Dojo provides demo applications for their
  widgets
Community

• Active Mailing List / Forum
• Support and Training
• Popularity
Mailing List / Forum
• Prototype, jQuery, and Yahoo UI have
  mailing lists
 • Prototype: 23 posts/day
 • jQuery: 108 posts/day
 • Yahoo UI: 36 posts/day
• Dojo has an active forum
Support and Training


• Dojo provides paid support and training
  (via Sitepen)
Popularity

• Who uses what:
 • Prototype: Apple, ESPN, CNN, Fox News
 • jQuery: Google, Amazon, Digg, NBC, Intel
 • Yahoo:Yahoo, LinkedIn, Target, Slashdot
 • Dojo: IBM, AOL, Mapquest, Bloglines
More Information
• Prototype:
  http://prototypejs.org/
• jQuery:
  http://jquery.com/
• Yahoo UI:
  http://developer.yahoo.com/yui/
• Dojo:
  http://dojotoolkit.org/
Ajax Experience
      Presentations
• Presentations on:
 • Dojo (2)
 • Prototype (2) & Scriptaculous (1)
 • jQuery (3)
• Go to one that sounds interesting and
  enjoy!
1 of 83

Recommended

Javascript Best Practices by
Javascript Best PracticesJavascript Best Practices
Javascript Best PracticesChristian Heilmann
129.9K views145 slides
JavaScript - From Birth To Closure by
JavaScript - From Birth To ClosureJavaScript - From Birth To Closure
JavaScript - From Birth To ClosureRobert Nyman
51.9K views133 slides
Performance Optimization and JavaScript Best Practices by
Performance Optimization and JavaScript Best PracticesPerformance Optimization and JavaScript Best Practices
Performance Optimization and JavaScript Best PracticesDoris Chen
3.6K views39 slides
Metaprogramming JavaScript by
Metaprogramming  JavaScriptMetaprogramming  JavaScript
Metaprogramming JavaScriptdanwrong
43.6K views94 slides
Intro to node.js - Ran Mizrahi (28/8/14) by
Intro to node.js - Ran Mizrahi (28/8/14)Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)Ran Mizrahi
564 views34 slides

More Related Content

What's hot

How AngularJS Embraced Traditional Design Patterns by
How AngularJS Embraced Traditional Design PatternsHow AngularJS Embraced Traditional Design Patterns
How AngularJS Embraced Traditional Design PatternsRan Mizrahi
12.4K views27 slides
Secrets of JavaScript Libraries by
Secrets of JavaScript LibrariesSecrets of JavaScript Libraries
Secrets of JavaScript Librariesjeresig
41.5K views78 slides
Intro To JavaScript Unit Testing - Ran Mizrahi by
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiRan Mizrahi
2.4K views31 slides
Object Oriented Programming In JavaScript by
Object Oriented Programming In JavaScriptObject Oriented Programming In JavaScript
Object Oriented Programming In JavaScriptForziatech
3.6K views22 slides
Ajax Security by
Ajax SecurityAjax Security
Ajax SecurityJoe Walker
42.6K views83 slides
From YUI3 to K2 by
From YUI3 to K2From YUI3 to K2
From YUI3 to K2kaven yan
7.7K views46 slides

What's hot(20)

How AngularJS Embraced Traditional Design Patterns by Ran Mizrahi
How AngularJS Embraced Traditional Design PatternsHow AngularJS Embraced Traditional Design Patterns
How AngularJS Embraced Traditional Design Patterns
Ran Mizrahi12.4K views
Secrets of JavaScript Libraries by jeresig
Secrets of JavaScript LibrariesSecrets of JavaScript Libraries
Secrets of JavaScript Libraries
jeresig41.5K views
Intro To JavaScript Unit Testing - Ran Mizrahi by Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran Mizrahi
Ran Mizrahi2.4K views
Object Oriented Programming In JavaScript by Forziatech
Object Oriented Programming In JavaScriptObject Oriented Programming In JavaScript
Object Oriented Programming In JavaScript
Forziatech3.6K views
Ajax Security by Joe Walker
Ajax SecurityAjax Security
Ajax Security
Joe Walker42.6K views
From YUI3 to K2 by kaven yan
From YUI3 to K2From YUI3 to K2
From YUI3 to K2
kaven yan7.7K views
Javascript and Jquery Best practices by Sultan Khan
Javascript and Jquery Best practicesJavascript and Jquery Best practices
Javascript and Jquery Best practices
Sultan Khan1.2K views
ActiveJDBC - ActiveRecord implementation in Java by ipolevoy
ActiveJDBC - ActiveRecord implementation in JavaActiveJDBC - ActiveRecord implementation in Java
ActiveJDBC - ActiveRecord implementation in Java
ipolevoy4.3K views
Intro to JavaScript Testing by Ran Mizrahi
Intro to JavaScript TestingIntro to JavaScript Testing
Intro to JavaScript Testing
Ran Mizrahi4K views
Patterns for JVM languages - Geecon 2014 by Jaroslaw Palka
Patterns for JVM languages - Geecon 2014Patterns for JVM languages - Geecon 2014
Patterns for JVM languages - Geecon 2014
Jaroslaw Palka1.5K views
Design patterns revisited with PHP 5.3 by Fabien Potencier
Design patterns revisited with PHP 5.3Design patterns revisited with PHP 5.3
Design patterns revisited with PHP 5.3
Fabien Potencier67.1K views
ActiveWeb: Chicago Java User Group Presentation by ipolevoy
ActiveWeb: Chicago Java User Group PresentationActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentation
ipolevoy2K views
JavaScript Best Pratices by ChengHui Weng
JavaScript Best PraticesJavaScript Best Pratices
JavaScript Best Pratices
ChengHui Weng360 views
How to make Ajax work for you by Simon Willison
How to make Ajax work for youHow to make Ajax work for you
How to make Ajax work for you
Simon Willison44.2K views
Javascript best practices by Manav Gupta
Javascript best practicesJavascript best practices
Javascript best practices
Manav Gupta901 views
Fundamental JavaScript [In Control 2009] by Aaron Gustafson
Fundamental JavaScript [In Control 2009]Fundamental JavaScript [In Control 2009]
Fundamental JavaScript [In Control 2009]
Aaron Gustafson3K views
Mastering Java Bytecode - JAX.de 2012 by Anton Arhipov
Mastering Java Bytecode - JAX.de 2012Mastering Java Bytecode - JAX.de 2012
Mastering Java Bytecode - JAX.de 2012
Anton Arhipov2.6K views
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin... by Matt Raible
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Matt Raible68.4K views

Viewers also liked

JavaScript - An Introduction by
JavaScript - An IntroductionJavaScript - An Introduction
JavaScript - An IntroductionManvendra Singh
19.1K views65 slides
Scalable JavaScript Application Architecture by
Scalable JavaScript Application ArchitectureScalable JavaScript Application Architecture
Scalable JavaScript Application ArchitectureNicholas Zakas
176.2K views108 slides
JavaScript Programming by
JavaScript ProgrammingJavaScript Programming
JavaScript ProgrammingSehwan Noh
14.9K views81 slides
Unobtrusive JavaScript with jQuery by
Unobtrusive JavaScript with jQueryUnobtrusive JavaScript with jQuery
Unobtrusive JavaScript with jQuerySimon Willison
17.3K views134 slides
Writing Efficient JavaScript by
Writing Efficient JavaScriptWriting Efficient JavaScript
Writing Efficient JavaScriptNicholas Zakas
88.3K views139 slides
Wynn Netherland: Accelerating Titanium Development with CoffeeScript, Compass... by
Wynn Netherland: Accelerating Titanium Development with CoffeeScript, Compass...Wynn Netherland: Accelerating Titanium Development with CoffeeScript, Compass...
Wynn Netherland: Accelerating Titanium Development with CoffeeScript, Compass...Axway Appcelerator
1.4K views165 slides

Viewers also liked(20)

JavaScript - An Introduction by Manvendra Singh
JavaScript - An IntroductionJavaScript - An Introduction
JavaScript - An Introduction
Manvendra Singh19.1K views
Scalable JavaScript Application Architecture by Nicholas Zakas
Scalable JavaScript Application ArchitectureScalable JavaScript Application Architecture
Scalable JavaScript Application Architecture
Nicholas Zakas176.2K views
JavaScript Programming by Sehwan Noh
JavaScript ProgrammingJavaScript Programming
JavaScript Programming
Sehwan Noh14.9K views
Unobtrusive JavaScript with jQuery by Simon Willison
Unobtrusive JavaScript with jQueryUnobtrusive JavaScript with jQuery
Unobtrusive JavaScript with jQuery
Simon Willison17.3K views
Writing Efficient JavaScript by Nicholas Zakas
Writing Efficient JavaScriptWriting Efficient JavaScript
Writing Efficient JavaScript
Nicholas Zakas88.3K views
Wynn Netherland: Accelerating Titanium Development with CoffeeScript, Compass... by Axway Appcelerator
Wynn Netherland: Accelerating Titanium Development with CoffeeScript, Compass...Wynn Netherland: Accelerating Titanium Development with CoffeeScript, Compass...
Wynn Netherland: Accelerating Titanium Development with CoffeeScript, Compass...
Axway Appcelerator1.4K views
Happy Programming with CoffeeScript by Eddie Kao
Happy Programming with CoffeeScriptHappy Programming with CoffeeScript
Happy Programming with CoffeeScript
Eddie Kao11K views
High Performance JavaScript - jQuery Conference SF Bay Area 2010 by Nicholas Zakas
High Performance JavaScript - jQuery Conference SF Bay Area 2010High Performance JavaScript - jQuery Conference SF Bay Area 2010
High Performance JavaScript - jQuery Conference SF Bay Area 2010
Nicholas Zakas47.7K views
Dom API In Java Script by Rajat Pandit
Dom API In Java ScriptDom API In Java Script
Dom API In Java Script
Rajat Pandit2.1K views
5 Tips for Better JavaScript by Todd Anglin
5 Tips for Better JavaScript5 Tips for Better JavaScript
5 Tips for Better JavaScript
Todd Anglin72.5K views
Introduction about-ajax-framework by Sakthi Bro
Introduction about-ajax-frameworkIntroduction about-ajax-framework
Introduction about-ajax-framework
Sakthi Bro780 views
High Performance JavaScript - WebDirections USA 2010 by Nicholas Zakas
High Performance JavaScript - WebDirections USA 2010High Performance JavaScript - WebDirections USA 2010
High Performance JavaScript - WebDirections USA 2010
Nicholas Zakas59.7K views
CoffeeScriptってなんぞ? by Hayato Mizuno
CoffeeScriptってなんぞ?CoffeeScriptってなんぞ?
CoffeeScriptってなんぞ?
Hayato Mizuno13.5K views
Reverse Engineering Malicious Javascript by Yusuf Motiwala
Reverse Engineering Malicious JavascriptReverse Engineering Malicious Javascript
Reverse Engineering Malicious Javascript
Yusuf Motiwala7.4K views
Linux Yaz Kampı 2016 pfSense Firewall ve Router Eğitim Dökümanı by İbrahim UÇAR
Linux Yaz Kampı 2016 pfSense Firewall ve Router Eğitim DökümanıLinux Yaz Kampı 2016 pfSense Firewall ve Router Eğitim Dökümanı
Linux Yaz Kampı 2016 pfSense Firewall ve Router Eğitim Dökümanı
İbrahim UÇAR2.8K views

Similar to JavaScript Library Overview

JavaScript Libraries (Kings of Code) by
JavaScript Libraries (Kings of Code)JavaScript Libraries (Kings of Code)
JavaScript Libraries (Kings of Code)jeresig
2.2K views83 slides
JavaScript Libraries (@Media) by
JavaScript Libraries (@Media)JavaScript Libraries (@Media)
JavaScript Libraries (@Media)jeresig
2.6K views89 slides
JavaScript Library Overview by
JavaScript Library OverviewJavaScript Library Overview
JavaScript Library Overviewjeresig
32.3K views94 slides
How to make Ajax Libraries work for you by
How to make Ajax Libraries work for youHow to make Ajax Libraries work for you
How to make Ajax Libraries work for youSimon Willison
1.4K views51 slides
JavaScript Library Overview (Ajax Exp West 2007) by
JavaScript Library Overview (Ajax Exp West 2007)JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)jeresig
1.4K views62 slides
JavaScript Libraries (Ajax Exp 2006) by
JavaScript Libraries (Ajax Exp 2006)JavaScript Libraries (Ajax Exp 2006)
JavaScript Libraries (Ajax Exp 2006)jeresig
3.1K views62 slides

Similar to JavaScript Library Overview(20)

JavaScript Libraries (Kings of Code) by jeresig
JavaScript Libraries (Kings of Code)JavaScript Libraries (Kings of Code)
JavaScript Libraries (Kings of Code)
jeresig2.2K views
JavaScript Libraries (@Media) by jeresig
JavaScript Libraries (@Media)JavaScript Libraries (@Media)
JavaScript Libraries (@Media)
jeresig2.6K views
JavaScript Library Overview by jeresig
JavaScript Library OverviewJavaScript Library Overview
JavaScript Library Overview
jeresig32.3K views
How to make Ajax Libraries work for you by Simon Willison
How to make Ajax Libraries work for youHow to make Ajax Libraries work for you
How to make Ajax Libraries work for you
Simon Willison1.4K views
JavaScript Library Overview (Ajax Exp West 2007) by jeresig
JavaScript Library Overview (Ajax Exp West 2007)JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)
jeresig1.4K views
JavaScript Libraries (Ajax Exp 2006) by jeresig
JavaScript Libraries (Ajax Exp 2006)JavaScript Libraries (Ajax Exp 2006)
JavaScript Libraries (Ajax Exp 2006)
jeresig3.1K views
Starting with jQuery by Anil Kumar
Starting with jQueryStarting with jQuery
Starting with jQuery
Anil Kumar1.7K views
jQuery - the world's most popular java script library comes to XPages by Mark Roden
jQuery - the world's most popular java script library comes to XPagesjQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPages
Mark Roden7.8K views
JavaScript Libraries: The Big Picture by Simon Willison
JavaScript Libraries: The Big PictureJavaScript Libraries: The Big Picture
JavaScript Libraries: The Big Picture
Simon Willison4K views
jQuery and_drupal by BlackCatWeb
jQuery and_drupaljQuery and_drupal
jQuery and_drupal
BlackCatWeb352 views
jQuery Features to Avoid by dmethvin
jQuery Features to AvoidjQuery Features to Avoid
jQuery Features to Avoid
dmethvin1.6K views
qooxdoo - Open Source Ajax Framework by ecker
qooxdoo - Open Source Ajax Frameworkqooxdoo - Open Source Ajax Framework
qooxdoo - Open Source Ajax Framework
ecker1.3K views
Learning jQuery @ MIT by jeresig
Learning jQuery @ MITLearning jQuery @ MIT
Learning jQuery @ MIT
jeresig1.5K views
DOJO by Mahi Mca
DOJO DOJO
DOJO
Mahi Mca545 views
Building a JavaScript Library by jeresig
Building a JavaScript LibraryBuilding a JavaScript Library
Building a JavaScript Library
jeresig11.7K views
Ajax Tutorial by oscon2007
Ajax TutorialAjax Tutorial
Ajax Tutorial
oscon2007605 views
jQuery - Chapter 1 - Introduction by WebStackAcademy
 jQuery - Chapter 1 - Introduction jQuery - Chapter 1 - Introduction
jQuery - Chapter 1 - Introduction
WebStackAcademy683 views

More from jeresig

Does Coding Every Day Matter? by
Does Coding Every Day Matter?Does Coding Every Day Matter?
Does Coding Every Day Matter?jeresig
3K views19 slides
Accidentally Becoming a Digital Librarian by
Accidentally Becoming a Digital LibrarianAccidentally Becoming a Digital Librarian
Accidentally Becoming a Digital Librarianjeresig
1.3K views72 slides
2014: John's Favorite Thing (Neo4j) by
2014: John's Favorite Thing (Neo4j)2014: John's Favorite Thing (Neo4j)
2014: John's Favorite Thing (Neo4j)jeresig
847 views42 slides
Computer Vision as Art Historical Investigation by
Computer Vision as Art Historical InvestigationComputer Vision as Art Historical Investigation
Computer Vision as Art Historical Investigationjeresig
1K views89 slides
Hacking Art History by
Hacking Art HistoryHacking Art History
Hacking Art Historyjeresig
925 views107 slides
Using JS to teach JS at Khan Academy by
Using JS to teach JS at Khan AcademyUsing JS to teach JS at Khan Academy
Using JS to teach JS at Khan Academyjeresig
1K views25 slides

More from jeresig(20)

Does Coding Every Day Matter? by jeresig
Does Coding Every Day Matter?Does Coding Every Day Matter?
Does Coding Every Day Matter?
jeresig3K views
Accidentally Becoming a Digital Librarian by jeresig
Accidentally Becoming a Digital LibrarianAccidentally Becoming a Digital Librarian
Accidentally Becoming a Digital Librarian
jeresig1.3K views
2014: John's Favorite Thing (Neo4j) by jeresig
2014: John's Favorite Thing (Neo4j)2014: John's Favorite Thing (Neo4j)
2014: John's Favorite Thing (Neo4j)
jeresig847 views
Computer Vision as Art Historical Investigation by jeresig
Computer Vision as Art Historical InvestigationComputer Vision as Art Historical Investigation
Computer Vision as Art Historical Investigation
jeresig1K views
Hacking Art History by jeresig
Hacking Art HistoryHacking Art History
Hacking Art History
jeresig925 views
Using JS to teach JS at Khan Academy by jeresig
Using JS to teach JS at Khan AcademyUsing JS to teach JS at Khan Academy
Using JS to teach JS at Khan Academy
jeresig1K views
Applying Computer Vision to Art History by jeresig
Applying Computer Vision to Art HistoryApplying Computer Vision to Art History
Applying Computer Vision to Art History
jeresig826 views
NYARC 2014: Frick/Zeri Results by jeresig
NYARC 2014: Frick/Zeri ResultsNYARC 2014: Frick/Zeri Results
NYARC 2014: Frick/Zeri Results
jeresig2.1K views
EmpireJS: Hacking Art with Node js and Image Analysis by jeresig
EmpireJS: Hacking Art with Node js and Image AnalysisEmpireJS: Hacking Art with Node js and Image Analysis
EmpireJS: Hacking Art with Node js and Image Analysis
jeresig18.5K views
Applying Computer Vision to Art History by jeresig
Applying Computer Vision to Art HistoryApplying Computer Vision to Art History
Applying Computer Vision to Art History
jeresig3.1K views
Introduction to jQuery (Ajax Exp 2006) by jeresig
Introduction to jQuery (Ajax Exp 2006)Introduction to jQuery (Ajax Exp 2006)
Introduction to jQuery (Ajax Exp 2006)
jeresig2.4K views
jQuery Recommendations to the W3C (2011) by jeresig
jQuery Recommendations to the W3C (2011)jQuery Recommendations to the W3C (2011)
jQuery Recommendations to the W3C (2011)
jeresig1.7K views
jQuery Open Source Process (RIT 2011) by jeresig
jQuery Open Source Process (RIT 2011)jQuery Open Source Process (RIT 2011)
jQuery Open Source Process (RIT 2011)
jeresig1.7K views
jQuery Open Source Process (Knight Foundation 2011) by jeresig
jQuery Open Source Process (Knight Foundation 2011)jQuery Open Source Process (Knight Foundation 2011)
jQuery Open Source Process (Knight Foundation 2011)
jeresig2.2K views
jQuery Mobile by jeresig
jQuery MobilejQuery Mobile
jQuery Mobile
jeresig1.5K views
jQuery Open Source (Fronteer 2011) by jeresig
jQuery Open Source (Fronteer 2011)jQuery Open Source (Fronteer 2011)
jQuery Open Source (Fronteer 2011)
jeresig4K views
Holistic JavaScript Performance by jeresig
Holistic JavaScript PerformanceHolistic JavaScript Performance
Holistic JavaScript Performance
jeresig4K views
New Features Coming in Browsers (RIT '09) by jeresig
New Features Coming in Browsers (RIT '09)New Features Coming in Browsers (RIT '09)
New Features Coming in Browsers (RIT '09)
jeresig1.5K views
Introduction to jQuery (Ajax Exp 2007) by jeresig
Introduction to jQuery (Ajax Exp 2007)Introduction to jQuery (Ajax Exp 2007)
Introduction to jQuery (Ajax Exp 2007)
jeresig1.3K views
Advanced jQuery (Ajax Exp 2007) by jeresig
Advanced jQuery (Ajax Exp 2007)Advanced jQuery (Ajax Exp 2007)
Advanced jQuery (Ajax Exp 2007)
jeresig1.3K views

JavaScript Library Overview

  • 1. JavaScript Libraries Ajax Experience - October 2007 John Resig (ejohn.org)
  • 2. Question: How do you want to write JavaScript?
  • 3. 1) Plug-and-Play • Drop in a “calendar widget” or “tabbed navigation” • Little, to no, JavaScript experience required. • Just customize some options and go. • No flexibility.
  • 4. 2) Some Assembly Required • Write common utilities • Click a link, load a page via Ajax • Build a dynamic menu • Creating interactive forms • Use pre-made code to distance yourself from browser bugs. • Flexible, until you hit a browser bug.
  • 5. 3) Down-and-Dirty • Write all JavaScript code from scratch • Deal, directly, with browser bugs • Quirksmode is your lifeline • Excessively flexible, to the point of hinderance.
  • 6. What we’ve just seen... • Widgets • Libraries • Raw JavaScript
  • 7. What we’ve just seen... • Widgets • Libraries • Raw JavaScript
  • 8. Why use a library? • Makes JavaScript bearable • Gets the job done fast • Simplifies cross-browser support • Sort of like C stdlib - no one just codes all of C by hand
  • 9. What kind of libraries exist? Open Source Commercial Atlas Client/ AjaxCFC Backbase for Server Qcodo Struts Prototype Browser jQuery Backbase Only Yahoo UI SmartClient Dojo
  • 10. What kind of libraries exist? Open Source Commercial Atlas Client/ AjaxCFC Backbase for Server Qcodo Struts Prototype Browser jQuery Backbase Only Yahoo UI SmartClient Dojo
  • 11. Open Source Libraries Browser Only Client/Server Scriptaculous Task AjaxCFC moo.fx Specific Qcodo Open Rico Prototype General jQuery Ruby on Rails Purpose Yahoo UI CakePHP Dojo
  • 12. Open Source Libraries Browser Only Client/Server Scriptaculous Task AjaxCFC moo.fx Specific Qcodo Open Rico Prototype General jQuery Ruby on Rails Purpose Yahoo UI CakePHP Dojo
  • 14. Ajaxian Survey Prototype jQuery Yahoo UI Dojo 20% 35% 21% 25% http://ajaxian.com/archives/ajaxian-2007-survey-results
  • 15. Google Trends Prototype jQuery Dojo Yahoo UI http://google.com/trends?q=prototype+javascript%2C+jquery+javascript%2C+yui+javascript%2C+dojo+javascript&ctab=0&geo=all&date=all&sort=0
  • 18. Prototype: Overview • Started early 2005 by Sam Stephenson • Incredibly popular, tied with Ruby on Rails’ popularity • Development backed by 37 Signals
  • 19. Prototype: Focus • Improving the usability of the JavaScript language • Big emphasis on adding in ‘missing’ JavaScript features • Clean structure, clean objects and ‘classes’
  • 20. Prototype: Details • Code quality is fantastic, great features • All animations (and interactions) are in Scriptaculous • Updated frequently • Looking at Prototype 1.6.0
  • 22. jQuery: Overview • Released January 2006 by John Resig • Rapid rise in popularity • Many developers across the globe
  • 23. jQuery: Focus • Improving the interaction between JavaScript and HTML • Finding elements then performing actions • Highly-effective, short, code
  • 24. jQuery: Details • Core features are limited to DOM, Events, Effects, Ajax • Other features can be added in via plugins • Looking at jQuery 1.2.1
  • 26. YUI: Overview • Released Feb 2006 by Yahoo! • Maintained and financed internally • Attempt to standardize internal JavaScript
  • 27. YUI: Focus • Exposing, and solving, common methodologies • Looking for common idioms (Drag-and- Drop, Calendar, Auto-Complete) • Looking at Yahoo UI 2.3.1
  • 28. Dojo
  • 29. Dojo: Overview • Started early 2005 by Alex Russell + Co. • Large development community • Lots of corporate backing (IBM, AOL) • Big code base, tons of features
  • 30. Dojo: Focus • Building complete web applications • A package heirarchy, e.g.: dojo.addClass( ... ) • Focus has transcended into widgets (Dijit) • Huge number of features • Today we’re looking at Dojo 0.9
  • 31. What should a library have?
  • 32. Code Base • Core Functionality • DOM • Events • Ajax • Animations • User Interface Widgets
  • 33. Development • Good Architecture • Open Licensing • Wide Browser Support • Small File Size
  • 34. Project • Development Team (Open, Funded) • Code in SVN / Bug Tracker • Good Unit Test Coverage
  • 35. Documentation • Full API Coverage • Plenty of Tutorials • Some Books • Wide variety of Demos
  • 36. Community • Active Mailing List / Forum • Support and Training • Popularity
  • 37. Code Base • Core Functionality • DOM • Events • Ajax • Animations • User Interface Widgets
  • 38. Core Functionality • Bare minimum needed to make a dynamic “Ajax” web site: • DOM (Traversal and Manipulation) • Events • Ajax • Animations
  • 39. DOM • Traversal • Using CSS selectors to locate elements • Modification • Create/remove/modify elements • Having a DOM builder is important
  • 40. DOM Traversal • Prototype: $$(“table > tr”) • jQuery: $(“div > p:nth-child(odd)”) • Dojo: dojo.query(“table tr:nth-child(even)”) • Yahoo UI: No querying support
  • 41. DOM Modification • Prototype: Insertion.Bottom(“list”,”<li>Another item</li>”); • jQuery: $(“#li”).append(“<li>An item</li>”); • Dojo and Yahoo UI have weak support - no DOM building capabilities, basic property modification
  • 42. Events • Support for simple event binding/removal • Support for custom events is essential • Prototype: Event.observe(“button”,”click”, function(){ alert(“Thanks for the click!”); }); • jQuery: $(“div”).click(function(){ alert(“div clicked”); });
  • 43. Events (cont.) • Yahoo UI: YAHOO.util.Event.addEventListener(“list”, “click”, function(){ alert(“List Clicked”); }); • Dojo: dojo.connect(dojo.byId(quot;mylinkquot;), quot;clickquot;, function(){ alert(“Link clicked”); });
  • 44. Custom Events • $(“#list”).bind(“drag”, function(){ $(this).addClass(“dragged”); }); • $(“#test”).trigger(“drag”);
  • 45. Ajax • Request and load remote documents • Prototype: new Ajax.Request(“test.html”, { method: “GET”, onComplete: function(res){ $(‘results’).innerHTML = res.responseText; } }); • jQuery: $(“#results”).load(“test.html”);
  • 46. Ajax (cont.) • Yahoo UI YAHOO.util.Connect.asyncRequest( 'GET', “test.html”, function(data){ YAHOO.util.Dom.id(“results”).innerHTML = data; } ); • Dojo dojo.io.bind({ url: quot;test.htmlquot;, method: quot;getquot;, mimetype: quot;text/htmlquot;, load: function(type, data) { dojo.byId(“results”).innerHTML = data; } });
  • 47. Ajax (cont.) • jQuery is only one capable of doing DOM traversing over XML • jQuery.get(“test.xml”, function(xml){ $(“user”, xml).each(function(){ $(“<li/>”).text( $(this).text() ) .appendTo(“#userlist”); }); });
  • 48. Animations • Simple animations (hide/show/toggle) • Provide elegant transitions • No animations in Prototype Core (see Scriptaculous, instead) • jQuery: $(“#menu”).slideDown(“slow”);
  • 49. Animations (cont.) • Yahoo UI: new YAHOO.util.Anim(“list”, { width: { from: 10, to: 100 } }, 1, YAHOO.util.Easing.easeOut ); • Dojo: dojo.fadeOut({ node: dojo.byId(“list”), duration: 500 });
  • 50. Core Feature Summary DOM Events Anim. Ajax Prototype X X - X jQuery X X X X Yahoo UI / X X X Dojo / X X X
  • 51. User Interface Widgets • ejohn.org <-- slides • Difficult to implement components, made easy • Commonly used, save duplication • Some common components: Drag & Drop, Tree, Grid, Modal Dialog, Tabbed Pane, Menu / Toolbar, Datepicker, Slider
  • 52. User Interface Packages • Only looking at officially-supported code: • Prototype has Scriptaculous • jQuery has jQuery UI • Dojo has Dijit • Included in Yahoo UI
  • 53. Drag & Drop • Drag an item from one location and drop in an other • Supported by all libraries
  • 54. Tree • A navigable hierarchy (like a folder/file explorer) • In Dojo and Yahoo UI
  • 55. Grid • An advanced table (resizable, editable, easily navigable) • In Dojo and Yahoo UI
  • 56. Modal Dialog • Display confined content (usually drag & droppable) and confirmation dialogs • In Dojo,Yahoo UI, and jQuery
  • 57. Tabbed Pane • Multiple panes of content navigable by a series of tabs • In Dojo,Yahoo UI, and jQuery
  • 58. Menu / Toolbar • A list of navigable items (with sub-menus) • In Dojo and Yahoo UI
  • 59. Datepicker • An input for selecting a date (or a range of dates) • In Dojo,Yahoo UI, and jQuery
  • 60. Slider • A draggable input for entering a general, numerical, value • In all libraries
  • 61. Tons More! • Color Picker (Dojo,YUI) • Layout (Dojo,YUI) • Auto Complete (Dojo, Proto,YUI) • Selectables (Proto, jQuery) • Accordion (Dojo, jQuery) • WYSIWYG (Dojo,YUI)
  • 62. Themeing • A consistent look-and-feel for widgets • jQuery,Yahoo UI, and Dojo provide themeing capabilities • jQuery’s and Yahoo UI’s are documented
  • 63. Accessibility • Taking in to consideration points from ARIA (Accessible Rich Internet Applications) • Dojo is taking a solid lead, here
  • 64. Development • Good Architecture • Open Licensing • Wide Browser Support • Small File Size
  • 65. Architecture • Bottom Up (Prototype, jQuery) vs. Top Down (Dojo,Yahoo UI) • jQuery, Dojo, and Yahoo UI all use a single namespace • Prototype extends native objects (high likelihood of inter-library conflict) • jQuery is extensible with plugins
  • 66. Licensing • All use liberal licenses (“Keep my name on the file, don’t sue me.”) • MIT: Prototype, jQuery • BSD: Yahoo UI, Dojo
  • 67. Browser Support • Everyone supports: IE 6+, Firefox 2+, Safari 2+, Opera 9+ • Except: • Prototype doesn’t support Opera • Dojo is dropping support for Safari 2
  • 68. File Size • Serving your JavaScript minified + Gzipped • Optimal level of compression and speed • Core file size (in KB): 35.00 26.25 17.50 8.75 0 Prototype jQuery Yahoo UI Dojo
  • 69. Project • Development Team (Open, Funded) • Code in SVN / Bug Tracker • Good Unit Test Coverage
  • 70. Development Team • Prototype, jQuery, and Dojo all have open development (anyone can contribute) • jQuery,Yahoo UI, and Dojo all have paid, full-time, developers working on the code • All have paid, part-time, developers
  • 71. SVN / Bug Tracker • Prototype, jQuery, and Dojo all have code in a public SVN repositor • Yahoo UI’s development is private and is limited to Yahoo employees • All libraries have a public bug tracker
  • 72. Unit Tests • All libraries have some automated unit tests • jQuery,Yahoo UI, and Dojo all have public unit tests • jQuery and Dojo have tests that can run in Rhino
  • 73. Documentation • Full API Coverage • Plenty of Tutorials • Some Books • Wide variety of Demos
  • 74. API Documentation • Prototype, jQuery, and Yahoo UI all have full coverage • jQuery provides runnable examples with each API item • Dojo’s coverage is spotty - work in progress
  • 75. Tutorials • All libraries provide some tutorials • jQuery and Yahoo UI have screencasts • Prototype: 6 • jQuery: 68 (English) • Yahoo UI: 32 • Dojo: 5
  • 76. Books • Prototype: • Prototype and Scriptaculous in Action (Manning) • Prototype and Scriptaculous (Pragmatic) • jQuery: • Learning jQuery (Packt) • jQuery Reference Guide (Packt) • Yahoo UI: None • Dojo: A short online book
  • 77. Demos • Yahoo UI provides a considerable number of live demos and examples for all features • jQuery provides live examples and a few demo applications • Dojo provides demo applications for their widgets
  • 78. Community • Active Mailing List / Forum • Support and Training • Popularity
  • 79. Mailing List / Forum • Prototype, jQuery, and Yahoo UI have mailing lists • Prototype: 23 posts/day • jQuery: 108 posts/day • Yahoo UI: 36 posts/day • Dojo has an active forum
  • 80. Support and Training • Dojo provides paid support and training (via Sitepen)
  • 81. Popularity • Who uses what: • Prototype: Apple, ESPN, CNN, Fox News • jQuery: Google, Amazon, Digg, NBC, Intel • Yahoo:Yahoo, LinkedIn, Target, Slashdot • Dojo: IBM, AOL, Mapquest, Bloglines
  • 82. More Information • Prototype: http://prototypejs.org/ • jQuery: http://jquery.com/ • Yahoo UI: http://developer.yahoo.com/yui/ • Dojo: http://dojotoolkit.org/
  • 83. Ajax Experience Presentations • Presentations on: • Dojo (2) • Prototype (2) & Scriptaculous (1) • jQuery (3) • Go to one that sounds interesting and enjoy!