SlideShare a Scribd company logo
1 of 62
Download to read offline
JavaScript Libraries
   Ajax Experience - July 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 C
  by hand
What kind of libraries exist?
          Open Source   Commercial
                           Atlas
Client/    AjaxCFC
                        Backbase for
Server      Qcodo
                           Struts
           Prototype
             Dojo
Browser                  Backbase
            jQuery
 Only                   SmartClient
           Mootools
           Yahoo UI
What kind of libraries exist?
          Open Source   Commercial
                           Atlas
Client/    AjaxCFC
                        Backbase for
Server      Qcodo
                           Struts
           Prototype
             Dojo
Browser                  Backbase
            jQuery
 Only                   SmartClient
           Mootools
           Yahoo UI
Open Source Libraries
          Browser Only    Client/Server
          Scriptaculous
 Task                       AjaxCFC
             moo.fx
Specific                      Qcodo
           Open Rico
           Prototype
             Dojo
General                   Ruby on Rails
            jQuery
Purpose                    CakePHP
           Mootools
           Yahoo UI
Open Source Libraries
          Browser Only    Client/Server
          Scriptaculous
 Task                       AjaxCFC
             moo.fx
Specific                      Qcodo
           Open Rico
           Prototype
             Dojo
General                   Ruby on Rails
            jQuery
Purpose                    CakePHP
           Mootools
           Yahoo UI
What should a library have?


• DOM Traversing/Manipulation
• Event binding
• Ajax Support
• Basic Animations
What should a library have?
• Some want complex controls
 • Drag-and-drop
 • Auto-complete search
• Others want language enhancements
 • Object.extend()
 • Array.each()
• DOM, Event, Effects, Ajax is a good middle-
  ground
Secondary Features


• Documentation
• Community Support
• File Size
• Popularity
Secondary Features

                      (Practical)
• Documentation
• Community Support
• File Size
• Popularity          (Esoteric)
The Libraries
Dojo
Dojo: Overview

• Started early 2005 by Alex Russell
• 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
Dojo: DOM Support


• Good DOM Modification support - handles
   many cross-browser issues
• Great DOM Traversal with Selectors
 dojo.forEach( dojo.query(“table tr:nth-child(even)”), function(row){
   dojo.addClass( row, "odd" );
 });
Dojo: Events and Effects

• Events support is complete and cross
   browser
• Good selection of generic animations
 dojo.connect(dojo.byId("mylink"), "click", function(){
    dojo.fadeOut({ node: this, duration: 500 });
 });
Dojo: Ajax

• Supports a wide variety of Ajax
  communication
• Cross-domain Ajax support
• Built-in back button support
Dojo: Docs & Community


• Documentation: Rough.
  In the middle of a major documentation
  overhaul for 0.9.
• Community: Lively
  Active forum with frequent discussions.
Dojo: File Size & Popularity

• File Size: Large (100Kb compressed)
  It’s highly recommended that you remove
  unused modules.
• Popularity: Substantial
  Backing from many corporate sponsors
  (IBM).
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: DOM Support


• DOM Modification works quite well:
  Insertion.Bottom(“list”,”<li>Another item</li>”);

• So does >DOM Traversing:
  $$(“table tr”).invoke(“addClassName”,”row”);
Prototype: Events & Ajax
• Event binding just works: function(){
  Event.observe(“button”,”click”,
        alert(“Thanks for the click!”);
  });

• So does Ajax:
  new Ajax.Request(“test.html”, {
        method: “GET”,
        onComplete: function(res){
          alert( res.responseText );
        }
  });
Prototype: Details

• Code quality is fantastic, great features
• No included support for animations
 • moo.fx
 • Script.aculo.us
• Updated frequently
Prototype: Docs & Community


• Documentation: Good
  Official API documentation, some tutorials
• Community: Distributed
  Many bloggers love Prototype, little
  centralized discussion (23 posts/day).
Prototype: File Size & Popularity


• File Size: Moderate (99KB)
  Unfortunately, not easily compressible with
  Packer - they recommend GZIP.
• Popularity: Strong
  Apple, NBC, ESPN, CNN, Amazon
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: DOM Support

• DOM Traversing is great - CSS1-3 support
  and basic XPath:
  $(“div > p:nth-child(odd)”)
• DOM Manipulation too:
  $(“#li”).append(“<li>An item</li>”);
jQuery: Events, Effects, and Ajax

• Events are fully functional:
  $(“div”).click( showItem );
• And effects:
  $(“#menu”).slideDown(“slow”);
• And Ajax!
  $(“form”).submit(function(){
      $(“#results”).load(“test.html”);
  });
jQuery: Details


• Core features are limited to DOM, Events,
  Effects, Ajax
• Other features can be added in via plugins
jQuery: Docs & Community


• Documentation: Complete
  Fully documented, complete API.
• Community: Vibrant
  108+ Mailing List Posts/Day
jQuery: File Size & Popularity


• File Size: Small
  About 20KB with everything.
• Popularity: Strong
  Users: IBM, Technorati, MSNBC, Digg
  Projects: Drupal, Wordpress
Mootools
Mootools: Overview


• Released Sept 2006 by Valerio Proietti
• Created as a fork of Prototype, Base, and
  moo.fx
Mootools: Focus

• Designed to fulfill common activities (All
  the way from low-level iteration to high-
  level Drag-and-Drop)
• Classical structure (like Prototype)
Mootools: DOM Support

• Good DOM Selector support:
  $$(“body”)
• Plenty of helper functions for DOM
  modification:
  $(‘test’).appendText(“foo”);
  $(‘test’).removeClass(“foo”);
Mootools: Events and Effects


• Has traditional event model:
  $(‘test’).addEvent(‘keydown’, function(){..});


• Plenty of visual effects too:
  var marginChange = new Fx.Style('myElement', 'margin-top',{duration:500});
  marginChange.start(10, 100);
Mootools: Ajax


• Ajax support is fully functional:
  var myAjax = new Ajax(url, {method: 'get'}).request();
Mootools: Details

• Lots of plug-and-play features
 • Drag-and-Drop
 • Accordion
 • Scrollbar
Mootools: Docs & Community


• Documentation: Good
  Good API coverage, some tutorials
• Community: Moderate
  Active forum, hostile against “newbies”
Mootools: File Size & Popularity


 • File Size: Small (approx. 25KB, compressed)
   Has a full compilation system, you can pick-
   and-choose components.
 • Popularity: Rising
   Ubuntu, C|Net
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)
YUI: DOM Support

• DOM Traversal is minimal, no selectors:
  YAHOO.util.Dom.get(“list”)
• DOM Modification is also minimal,
  modification only (no DOM creation):
  YAHOO.util.Dom.addClass(“list”,”hover”)
YUI: Events and Effects
• Full Event support:
  YAHOO.util.Event.addEventListener(
        “list”, “click”, function(){
            alert(“List Clicked”);
        });

• Animations are also customizable:
  new YAHOO.util.Anim(“list”,
        { width: { from: 10, to: 100 } }, 1,
        YAHOO.util.Easing.easeOut
   );
YUI: Ajax

• Ajax connections are simple to setup:
  YAHOO.util.Connect.asyncRequest(
       'GET', “test.html”, function(){
           alert(“File loaded”);
       }, null
  );
YUI: Details

• Namespaces can become quite verbose. It
  is recommended that you copy namespaces
  to other variables.
  var dom = YAHOO.util.Dom;
• Closed development (Yahoo employees
  only, no subversion repository)
YUI: Docs & Community


• Documentation: Excellent
  Everything is thoroughly documented. Lots
  of explanations, plenty of demos.
• Community: Moderate
  Mailing List hovering around 36 posts/day.
YUI: File Size & Popularity

• File Size: 40KB (Compressed)
  Code is quite modular, you can remove un-
  used code easily.
• Popularity: Possibly Waning
  Many good bloggers use to talk about it -
  have moved on.
Feature Summary
            DOM Events   Effects   Ajax
  Dojo       X     X       X        X

Prototype    X     X        -       X
 jQuery      X     X       X        X
Mootools     X     X       X        X

Yahoo UI     /     X       X        X
More Information

• Dojo: http://dojotoolkit.org/
• Prototype: http://prototypejs.org/
• jQuery: http://jquery.com/
• Mootools: http://mootools.net/
• Yahoo! UI: http://developer.yahoo.com/yui/
Ajax Experience
      Presentations
• Presentations on:
 • Dojo (3)
 • Prototype (3) & Scriptaculous (1)
 • jQuery (3)
• Go to one that sounds interesting and
  enjoy!

More Related Content

What's hot

jQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingjQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingDoug Neiner
 
JavaScript Libraries (Kings of Code)
JavaScript Libraries (Kings of Code)JavaScript Libraries (Kings of Code)
JavaScript Libraries (Kings of Code)jeresig
 
Drupal 7: What's In It For You?
Drupal 7: What's In It For You?Drupal 7: What's In It For You?
Drupal 7: What's In It For You?karschsp
 
CT presentatie JQuery 7.12.11
CT presentatie JQuery 7.12.11CT presentatie JQuery 7.12.11
CT presentatie JQuery 7.12.11virtualsciences41
 
JavaScript Libraries (@Media)
JavaScript Libraries (@Media)JavaScript Libraries (@Media)
JavaScript Libraries (@Media)jeresig
 
JavaScript!
JavaScript!JavaScript!
JavaScript!RTigger
 
Short intro to JQuery and Modernizr
Short intro to JQuery and ModernizrShort intro to JQuery and Modernizr
Short intro to JQuery and ModernizrJussi Pohjolainen
 
jQuery (BostonPHP)
jQuery (BostonPHP)jQuery (BostonPHP)
jQuery (BostonPHP)jeresig
 
MongoDB at ZPUGDC
MongoDB at ZPUGDCMongoDB at ZPUGDC
MongoDB at ZPUGDCMike Dirolf
 
Introduction to j query
Introduction to j queryIntroduction to j query
Introduction to j querythewarlog
 
J query presentation
J query presentationJ query presentation
J query presentationakanksha17
 
A Short Introduction To jQuery
A Short Introduction To jQueryA Short Introduction To jQuery
A Short Introduction To jQuerySudar Muthu
 
jQuery (MeshU)
jQuery (MeshU)jQuery (MeshU)
jQuery (MeshU)jeresig
 
Introduction to Backbone - Workshop
Introduction to Backbone - WorkshopIntroduction to Backbone - Workshop
Introduction to Backbone - WorkshopOren Farhi
 
Angularjs vs Dojo toolkit | SuperSpeaker@CodeCamp Iasi 2014
Angularjs vs Dojo toolkit | SuperSpeaker@CodeCamp Iasi 2014Angularjs vs Dojo toolkit | SuperSpeaker@CodeCamp Iasi 2014
Angularjs vs Dojo toolkit | SuperSpeaker@CodeCamp Iasi 2014Endava
 

What's hot (19)

jQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingjQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and Bling
 
JavaScript Libraries (Kings of Code)
JavaScript Libraries (Kings of Code)JavaScript Libraries (Kings of Code)
JavaScript Libraries (Kings of Code)
 
Drupal 7: What's In It For You?
Drupal 7: What's In It For You?Drupal 7: What's In It For You?
Drupal 7: What's In It For You?
 
CT presentatie JQuery 7.12.11
CT presentatie JQuery 7.12.11CT presentatie JQuery 7.12.11
CT presentatie JQuery 7.12.11
 
jQuery Introduction
jQuery IntroductionjQuery Introduction
jQuery Introduction
 
JavaScript Libraries (@Media)
JavaScript Libraries (@Media)JavaScript Libraries (@Media)
JavaScript Libraries (@Media)
 
JavaScript!
JavaScript!JavaScript!
JavaScript!
 
D3.js and SVG
D3.js and SVGD3.js and SVG
D3.js and SVG
 
Short intro to JQuery and Modernizr
Short intro to JQuery and ModernizrShort intro to JQuery and Modernizr
Short intro to JQuery and Modernizr
 
jQuery (BostonPHP)
jQuery (BostonPHP)jQuery (BostonPHP)
jQuery (BostonPHP)
 
MongoDB at ZPUGDC
MongoDB at ZPUGDCMongoDB at ZPUGDC
MongoDB at ZPUGDC
 
Introduction to j query
Introduction to j queryIntroduction to j query
Introduction to j query
 
JQuery
JQueryJQuery
JQuery
 
J query presentation
J query presentationJ query presentation
J query presentation
 
A Short Introduction To jQuery
A Short Introduction To jQueryA Short Introduction To jQuery
A Short Introduction To jQuery
 
Couchdb Nosql
Couchdb NosqlCouchdb Nosql
Couchdb Nosql
 
jQuery (MeshU)
jQuery (MeshU)jQuery (MeshU)
jQuery (MeshU)
 
Introduction to Backbone - Workshop
Introduction to Backbone - WorkshopIntroduction to Backbone - Workshop
Introduction to Backbone - Workshop
 
Angularjs vs Dojo toolkit | SuperSpeaker@CodeCamp Iasi 2014
Angularjs vs Dojo toolkit | SuperSpeaker@CodeCamp Iasi 2014Angularjs vs Dojo toolkit | SuperSpeaker@CodeCamp Iasi 2014
Angularjs vs Dojo toolkit | SuperSpeaker@CodeCamp Iasi 2014
 

Similar to JavaScript Library Overview (Ajax Exp West 2007)

JavaScript Libraries (Ajax Exp 2006)
JavaScript Libraries (Ajax Exp 2006)JavaScript Libraries (Ajax Exp 2006)
JavaScript Libraries (Ajax Exp 2006)jeresig
 
JavaScript Library Overview
JavaScript Library OverviewJavaScript Library Overview
JavaScript Library Overviewjeresig
 
JavaScript Library Overview
JavaScript Library OverviewJavaScript Library Overview
JavaScript Library Overviewjeresig
 
Vlad Zelinschi - Embrace Native JavaScript (the anti-plugins talk) - Codecamp...
Vlad Zelinschi - Embrace Native JavaScript (the anti-plugins talk) - Codecamp...Vlad Zelinschi - Embrace Native JavaScript (the anti-plugins talk) - Codecamp...
Vlad Zelinschi - Embrace Native JavaScript (the anti-plugins talk) - Codecamp...Codecamp Romania
 
Starting with jQuery
Starting with jQueryStarting with jQuery
Starting with jQueryAnil Kumar
 
Building Real-World Dojo Web Applications
Building Real-World Dojo Web ApplicationsBuilding Real-World Dojo Web Applications
Building Real-World Dojo Web ApplicationsAndrew Ferrier
 
J query presentation
J query presentationJ query presentation
J query presentationsawarkar17
 
How to make Ajax Libraries work for you
How to make Ajax Libraries work for youHow to make Ajax Libraries work for you
How to make Ajax Libraries work for youSimon Willison
 
Introduction to the wonderful world of JavaScript
Introduction to the wonderful world of JavaScriptIntroduction to the wonderful world of JavaScript
Introduction to the wonderful world of JavaScriptJakob Torp
 
jQuery - Chapter 1 - Introduction
 jQuery - Chapter 1 - Introduction jQuery - Chapter 1 - Introduction
jQuery - Chapter 1 - IntroductionWebStackAcademy
 
Advancing JavaScript with Libraries (Yahoo Tech Talk)
Advancing JavaScript with Libraries (Yahoo Tech Talk)Advancing JavaScript with Libraries (Yahoo Tech Talk)
Advancing JavaScript with Libraries (Yahoo Tech Talk)jeresig
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
Content Outside of CONTENTdm: Part 1: Exhibit Creation Tool using &lt;b>...&l...
Content Outside of CONTENTdm: Part 1: Exhibit Creation Tool using &lt;b>...&l...Content Outside of CONTENTdm: Part 1: Exhibit Creation Tool using &lt;b>...&l...
Content Outside of CONTENTdm: Part 1: Exhibit Creation Tool using &lt;b>...&l...tutorialsruby
 
Google Dev Day2007
Google Dev Day2007Google Dev Day2007
Google Dev Day2007lucclaes
 
jQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesjQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesTeamstudio
 
Do you need jQuery in 2019?
Do you need jQuery in 2019?Do you need jQuery in 2019?
Do you need jQuery in 2019?LindaHsu19
 
jQuery - the world's most popular java script library comes to XPages
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 XPagesMark Roden
 
Masterin Large Scale Java Script Applications
Masterin Large Scale Java Script ApplicationsMasterin Large Scale Java Script Applications
Masterin Large Scale Java Script ApplicationsFabian Jakobs
 

Similar to JavaScript Library Overview (Ajax Exp West 2007) (20)

JavaScript Libraries (Ajax Exp 2006)
JavaScript Libraries (Ajax Exp 2006)JavaScript Libraries (Ajax Exp 2006)
JavaScript Libraries (Ajax Exp 2006)
 
JavaScript Library Overview
JavaScript Library OverviewJavaScript Library Overview
JavaScript Library Overview
 
JavaScript Library Overview
JavaScript Library OverviewJavaScript Library Overview
JavaScript Library Overview
 
Vlad Zelinschi - Embrace Native JavaScript (the anti-plugins talk) - Codecamp...
Vlad Zelinschi - Embrace Native JavaScript (the anti-plugins talk) - Codecamp...Vlad Zelinschi - Embrace Native JavaScript (the anti-plugins talk) - Codecamp...
Vlad Zelinschi - Embrace Native JavaScript (the anti-plugins talk) - Codecamp...
 
Starting with jQuery
Starting with jQueryStarting with jQuery
Starting with jQuery
 
Building Real-World Dojo Web Applications
Building Real-World Dojo Web ApplicationsBuilding Real-World Dojo Web Applications
Building Real-World Dojo Web Applications
 
J query presentation
J query presentationJ query presentation
J query presentation
 
How to make Ajax Libraries work for you
How to make Ajax Libraries work for youHow to make Ajax Libraries work for you
How to make Ajax Libraries work for you
 
Introduction to the wonderful world of JavaScript
Introduction to the wonderful world of JavaScriptIntroduction to the wonderful world of JavaScript
Introduction to the wonderful world of JavaScript
 
jQuery - Chapter 1 - Introduction
 jQuery - Chapter 1 - Introduction jQuery - Chapter 1 - Introduction
jQuery - Chapter 1 - Introduction
 
Advancing JavaScript with Libraries (Yahoo Tech Talk)
Advancing JavaScript with Libraries (Yahoo Tech Talk)Advancing JavaScript with Libraries (Yahoo Tech Talk)
Advancing JavaScript with Libraries (Yahoo Tech Talk)
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
psager
psagerpsager
psager
 
psager
psagerpsager
psager
 
Content Outside of CONTENTdm: Part 1: Exhibit Creation Tool using &lt;b>...&l...
Content Outside of CONTENTdm: Part 1: Exhibit Creation Tool using &lt;b>...&l...Content Outside of CONTENTdm: Part 1: Exhibit Creation Tool using &lt;b>...&l...
Content Outside of CONTENTdm: Part 1: Exhibit Creation Tool using &lt;b>...&l...
 
Google Dev Day2007
Google Dev Day2007Google Dev Day2007
Google Dev Day2007
 
jQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesjQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPages
 
Do you need jQuery in 2019?
Do you need jQuery in 2019?Do you need jQuery in 2019?
Do you need jQuery in 2019?
 
jQuery - the world's most popular java script library comes to XPages
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
 
Masterin Large Scale Java Script Applications
Masterin Large Scale Java Script ApplicationsMasterin Large Scale Java Script Applications
Masterin Large Scale Java Script Applications
 

More from jeresig

Does Coding Every Day Matter?
Does Coding Every Day Matter?Does Coding Every Day Matter?
Does Coding Every Day Matter?jeresig
 
Accidentally Becoming a Digital Librarian
Accidentally Becoming a Digital LibrarianAccidentally Becoming a Digital Librarian
Accidentally Becoming a Digital Librarianjeresig
 
2014: John's Favorite Thing (Neo4j)
2014: John's Favorite Thing (Neo4j)2014: John's Favorite Thing (Neo4j)
2014: John's Favorite Thing (Neo4j)jeresig
 
Computer Vision as Art Historical Investigation
Computer Vision as Art Historical InvestigationComputer Vision as Art Historical Investigation
Computer Vision as Art Historical Investigationjeresig
 
Hacking Art History
Hacking Art HistoryHacking Art History
Hacking Art Historyjeresig
 
Using JS to teach JS at Khan Academy
Using JS to teach JS at Khan AcademyUsing JS to teach JS at Khan Academy
Using JS to teach JS at Khan Academyjeresig
 
Applying Computer Vision to Art History
Applying Computer Vision to Art HistoryApplying Computer Vision to Art History
Applying Computer Vision to Art Historyjeresig
 
NYARC 2014: Frick/Zeri Results
NYARC 2014: Frick/Zeri ResultsNYARC 2014: Frick/Zeri Results
NYARC 2014: Frick/Zeri Resultsjeresig
 
EmpireJS: Hacking Art with Node js and Image Analysis
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 Analysisjeresig
 
Applying Computer Vision to Art History
Applying Computer Vision to Art HistoryApplying Computer Vision to Art History
Applying Computer Vision to Art Historyjeresig
 
jQuery Recommendations to the W3C (2011)
jQuery Recommendations to the W3C (2011)jQuery Recommendations to the W3C (2011)
jQuery Recommendations to the W3C (2011)jeresig
 
jQuery Open Source Process (RIT 2011)
jQuery Open Source Process (RIT 2011)jQuery Open Source Process (RIT 2011)
jQuery Open Source Process (RIT 2011)jeresig
 
jQuery Open Source Process (Knight Foundation 2011)
jQuery Open Source Process (Knight Foundation 2011)jQuery Open Source Process (Knight Foundation 2011)
jQuery Open Source Process (Knight Foundation 2011)jeresig
 
jQuery Mobile
jQuery MobilejQuery Mobile
jQuery Mobilejeresig
 
jQuery Open Source (Fronteer 2011)
jQuery Open Source (Fronteer 2011)jQuery Open Source (Fronteer 2011)
jQuery Open Source (Fronteer 2011)jeresig
 
Holistic JavaScript Performance
Holistic JavaScript PerformanceHolistic JavaScript Performance
Holistic JavaScript Performancejeresig
 
New Features Coming in Browsers (RIT '09)
New Features Coming in Browsers (RIT '09)New Features Coming in Browsers (RIT '09)
New Features Coming in Browsers (RIT '09)jeresig
 
Meta Programming with JavaScript
Meta Programming with JavaScriptMeta Programming with JavaScript
Meta Programming with JavaScriptjeresig
 
The Future of JavaScript (Ajax Exp '07)
The Future of JavaScript (Ajax Exp '07)The Future of JavaScript (Ajax Exp '07)
The Future of JavaScript (Ajax Exp '07)jeresig
 
Khan Academy Computer Science
Khan Academy Computer ScienceKhan Academy Computer Science
Khan Academy Computer Sciencejeresig
 

More from jeresig (20)

Does Coding Every Day Matter?
Does Coding Every Day Matter?Does Coding Every Day Matter?
Does Coding Every Day Matter?
 
Accidentally Becoming a Digital Librarian
Accidentally Becoming a Digital LibrarianAccidentally Becoming a Digital Librarian
Accidentally Becoming a Digital Librarian
 
2014: John's Favorite Thing (Neo4j)
2014: John's Favorite Thing (Neo4j)2014: John's Favorite Thing (Neo4j)
2014: John's Favorite Thing (Neo4j)
 
Computer Vision as Art Historical Investigation
Computer Vision as Art Historical InvestigationComputer Vision as Art Historical Investigation
Computer Vision as Art Historical Investigation
 
Hacking Art History
Hacking Art HistoryHacking Art History
Hacking Art History
 
Using JS to teach JS at Khan Academy
Using JS to teach JS at Khan AcademyUsing JS to teach JS at Khan Academy
Using JS to teach JS at Khan Academy
 
Applying Computer Vision to Art History
Applying Computer Vision to Art HistoryApplying Computer Vision to Art History
Applying Computer Vision to Art History
 
NYARC 2014: Frick/Zeri Results
NYARC 2014: Frick/Zeri ResultsNYARC 2014: Frick/Zeri Results
NYARC 2014: Frick/Zeri Results
 
EmpireJS: Hacking Art with Node js and Image Analysis
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
 
Applying Computer Vision to Art History
Applying Computer Vision to Art HistoryApplying Computer Vision to Art History
Applying Computer Vision to Art History
 
jQuery Recommendations to the W3C (2011)
jQuery Recommendations to the W3C (2011)jQuery Recommendations to the W3C (2011)
jQuery Recommendations to the W3C (2011)
 
jQuery Open Source Process (RIT 2011)
jQuery Open Source Process (RIT 2011)jQuery Open Source Process (RIT 2011)
jQuery Open Source Process (RIT 2011)
 
jQuery Open Source Process (Knight Foundation 2011)
jQuery Open Source Process (Knight Foundation 2011)jQuery Open Source Process (Knight Foundation 2011)
jQuery Open Source Process (Knight Foundation 2011)
 
jQuery Mobile
jQuery MobilejQuery Mobile
jQuery Mobile
 
jQuery Open Source (Fronteer 2011)
jQuery Open Source (Fronteer 2011)jQuery Open Source (Fronteer 2011)
jQuery Open Source (Fronteer 2011)
 
Holistic JavaScript Performance
Holistic JavaScript PerformanceHolistic JavaScript Performance
Holistic JavaScript Performance
 
New Features Coming in Browsers (RIT '09)
New Features Coming in Browsers (RIT '09)New Features Coming in Browsers (RIT '09)
New Features Coming in Browsers (RIT '09)
 
Meta Programming with JavaScript
Meta Programming with JavaScriptMeta Programming with JavaScript
Meta Programming with JavaScript
 
The Future of JavaScript (Ajax Exp '07)
The Future of JavaScript (Ajax Exp '07)The Future of JavaScript (Ajax Exp '07)
The Future of JavaScript (Ajax Exp '07)
 
Khan Academy Computer Science
Khan Academy Computer ScienceKhan Academy Computer Science
Khan Academy Computer Science
 

JavaScript Library Overview (Ajax Exp West 2007)

  • 1. JavaScript Libraries Ajax Experience - July 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 C by hand
  • 9. What kind of libraries exist? Open Source Commercial Atlas Client/ AjaxCFC Backbase for Server Qcodo Struts Prototype Dojo Browser Backbase jQuery Only SmartClient Mootools Yahoo UI
  • 10. What kind of libraries exist? Open Source Commercial Atlas Client/ AjaxCFC Backbase for Server Qcodo Struts Prototype Dojo Browser Backbase jQuery Only SmartClient Mootools Yahoo UI
  • 11. Open Source Libraries Browser Only Client/Server Scriptaculous Task AjaxCFC moo.fx Specific Qcodo Open Rico Prototype Dojo General Ruby on Rails jQuery Purpose CakePHP Mootools Yahoo UI
  • 12. Open Source Libraries Browser Only Client/Server Scriptaculous Task AjaxCFC moo.fx Specific Qcodo Open Rico Prototype Dojo General Ruby on Rails jQuery Purpose CakePHP Mootools Yahoo UI
  • 13. What should a library have? • DOM Traversing/Manipulation • Event binding • Ajax Support • Basic Animations
  • 14. What should a library have? • Some want complex controls • Drag-and-drop • Auto-complete search • Others want language enhancements • Object.extend() • Array.each() • DOM, Event, Effects, Ajax is a good middle- ground
  • 15. Secondary Features • Documentation • Community Support • File Size • Popularity
  • 16. Secondary Features (Practical) • Documentation • Community Support • File Size • Popularity (Esoteric)
  • 18. Dojo
  • 19. Dojo: Overview • Started early 2005 by Alex Russell • Large development community • Lots of corporate backing (IBM, AOL) • Big code base, tons of features
  • 20. 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
  • 21. Dojo: DOM Support • Good DOM Modification support - handles many cross-browser issues • Great DOM Traversal with Selectors dojo.forEach( dojo.query(“table tr:nth-child(even)”), function(row){ dojo.addClass( row, "odd" ); });
  • 22. Dojo: Events and Effects • Events support is complete and cross browser • Good selection of generic animations dojo.connect(dojo.byId("mylink"), "click", function(){ dojo.fadeOut({ node: this, duration: 500 }); });
  • 23. Dojo: Ajax • Supports a wide variety of Ajax communication • Cross-domain Ajax support • Built-in back button support
  • 24. Dojo: Docs & Community • Documentation: Rough. In the middle of a major documentation overhaul for 0.9. • Community: Lively Active forum with frequent discussions.
  • 25. Dojo: File Size & Popularity • File Size: Large (100Kb compressed) It’s highly recommended that you remove unused modules. • Popularity: Substantial Backing from many corporate sponsors (IBM).
  • 27. Prototype: Overview • Started early 2005 by Sam Stephenson • Incredibly popular, tied with Ruby on Rails’ popularity • Development backed by 37 Signals
  • 28. Prototype: Focus • Improving the usability of the JavaScript language • Big emphasis on adding in ‘missing’ JavaScript features • Clean structure, clean objects and ‘classes’
  • 29. Prototype: DOM Support • DOM Modification works quite well: Insertion.Bottom(“list”,”<li>Another item</li>”); • So does >DOM Traversing: $$(“table tr”).invoke(“addClassName”,”row”);
  • 30. Prototype: Events & Ajax • Event binding just works: function(){ Event.observe(“button”,”click”, alert(“Thanks for the click!”); }); • So does Ajax: new Ajax.Request(“test.html”, { method: “GET”, onComplete: function(res){ alert( res.responseText ); } });
  • 31. Prototype: Details • Code quality is fantastic, great features • No included support for animations • moo.fx • Script.aculo.us • Updated frequently
  • 32. Prototype: Docs & Community • Documentation: Good Official API documentation, some tutorials • Community: Distributed Many bloggers love Prototype, little centralized discussion (23 posts/day).
  • 33. Prototype: File Size & Popularity • File Size: Moderate (99KB) Unfortunately, not easily compressible with Packer - they recommend GZIP. • Popularity: Strong Apple, NBC, ESPN, CNN, Amazon
  • 35. jQuery: Overview • Released January 2006 by John Resig • Rapid rise in popularity • Many developers across the globe
  • 36. jQuery: Focus • Improving the interaction between JavaScript and HTML • Finding elements then performing actions • Highly-effective, short, code
  • 37. jQuery: DOM Support • DOM Traversing is great - CSS1-3 support and basic XPath: $(“div > p:nth-child(odd)”) • DOM Manipulation too: $(“#li”).append(“<li>An item</li>”);
  • 38. jQuery: Events, Effects, and Ajax • Events are fully functional: $(“div”).click( showItem ); • And effects: $(“#menu”).slideDown(“slow”); • And Ajax! $(“form”).submit(function(){ $(“#results”).load(“test.html”); });
  • 39. jQuery: Details • Core features are limited to DOM, Events, Effects, Ajax • Other features can be added in via plugins
  • 40. jQuery: Docs & Community • Documentation: Complete Fully documented, complete API. • Community: Vibrant 108+ Mailing List Posts/Day
  • 41. jQuery: File Size & Popularity • File Size: Small About 20KB with everything. • Popularity: Strong Users: IBM, Technorati, MSNBC, Digg Projects: Drupal, Wordpress
  • 43. Mootools: Overview • Released Sept 2006 by Valerio Proietti • Created as a fork of Prototype, Base, and moo.fx
  • 44. Mootools: Focus • Designed to fulfill common activities (All the way from low-level iteration to high- level Drag-and-Drop) • Classical structure (like Prototype)
  • 45. Mootools: DOM Support • Good DOM Selector support: $$(“body”) • Plenty of helper functions for DOM modification: $(‘test’).appendText(“foo”); $(‘test’).removeClass(“foo”);
  • 46. Mootools: Events and Effects • Has traditional event model: $(‘test’).addEvent(‘keydown’, function(){..}); • Plenty of visual effects too: var marginChange = new Fx.Style('myElement', 'margin-top',{duration:500}); marginChange.start(10, 100);
  • 47. Mootools: Ajax • Ajax support is fully functional: var myAjax = new Ajax(url, {method: 'get'}).request();
  • 48. Mootools: Details • Lots of plug-and-play features • Drag-and-Drop • Accordion • Scrollbar
  • 49. Mootools: Docs & Community • Documentation: Good Good API coverage, some tutorials • Community: Moderate Active forum, hostile against “newbies”
  • 50. Mootools: File Size & Popularity • File Size: Small (approx. 25KB, compressed) Has a full compilation system, you can pick- and-choose components. • Popularity: Rising Ubuntu, C|Net
  • 52. YUI: Overview • Released Feb 2006 by Yahoo! • Maintained and financed internally • Attempt to standardize internal JavaScript
  • 53. YUI: Focus • Exposing, and solving, common methodologies • Looking for common idioms (Drag-and- Drop, Calendar, Auto-Complete)
  • 54. YUI: DOM Support • DOM Traversal is minimal, no selectors: YAHOO.util.Dom.get(“list”) • DOM Modification is also minimal, modification only (no DOM creation): YAHOO.util.Dom.addClass(“list”,”hover”)
  • 55. YUI: Events and Effects • Full Event support: YAHOO.util.Event.addEventListener( “list”, “click”, function(){ alert(“List Clicked”); }); • Animations are also customizable: new YAHOO.util.Anim(“list”, { width: { from: 10, to: 100 } }, 1, YAHOO.util.Easing.easeOut );
  • 56. YUI: Ajax • Ajax connections are simple to setup: YAHOO.util.Connect.asyncRequest( 'GET', “test.html”, function(){ alert(“File loaded”); }, null );
  • 57. YUI: Details • Namespaces can become quite verbose. It is recommended that you copy namespaces to other variables. var dom = YAHOO.util.Dom; • Closed development (Yahoo employees only, no subversion repository)
  • 58. YUI: Docs & Community • Documentation: Excellent Everything is thoroughly documented. Lots of explanations, plenty of demos. • Community: Moderate Mailing List hovering around 36 posts/day.
  • 59. YUI: File Size & Popularity • File Size: 40KB (Compressed) Code is quite modular, you can remove un- used code easily. • Popularity: Possibly Waning Many good bloggers use to talk about it - have moved on.
  • 60. Feature Summary DOM Events Effects Ajax Dojo X X X X Prototype X X - X jQuery X X X X Mootools X X X X Yahoo UI / X X X
  • 61. More Information • Dojo: http://dojotoolkit.org/ • Prototype: http://prototypejs.org/ • jQuery: http://jquery.com/ • Mootools: http://mootools.net/ • Yahoo! UI: http://developer.yahoo.com/yui/
  • 62. Ajax Experience Presentations • Presentations on: • Dojo (3) • Prototype (3) & Scriptaculous (1) • jQuery (3) • Go to one that sounds interesting and enjoy!