SlideShare a Scribd company logo
Thomas Fuchs


    Combining advanced
JavaScript/DOM techniques
  and Ajax to build better
      User Interfaces
Thomas Fuchs



       Or:
Create Happy Users
Thomas Fuchs
• wollzelle
• Core team member of
  Ruby on Rails

• script.aculo.us
• mir.aculo.us
• Branding/Design/Web
• fluxiom Digital Asset
  Management
  http://www.fluxiom.com
• http://www.wollzelle.com/
Tools
JavaScript,
as seen by the browser




               Source: http://www.pollux.franken.de/KNF/
JavaScript Frameworks
     make you…
…write less code…
…code more elegantly…
…deal less with
browser bugs…
…and ultimately stay happy.
Concentrate on
your application…
…and not on
browser bugs.
1.5
Prototype is
JavaScript, reloaded
Ajax
Basic Ajax calls
(HTML snippets)
Ajax Forms
hot  topic
                             The
                                of 2 006!

     Ajax behaviours
     Server-side JavaScript generation:
Prototype automatically evaluates JavaScript
 when Content-type: text/javascript is set
Hooks for integration
with UI enhancements
(like activity indicators)
Extensions to
built-in object types
orcreatehappyusers
Enumerables
orcreatehappyusers
$ and $$
orcreatehappyusers
Direct Element
  extensions
Prototype 1.4



                vs
Prototype 1.5
.update()
   .replace()
   .remove()
    .visible()
   .setStyle()
.addClassName()
(…and lots more)
Events
(without cross-browser
         pain)
orcreatehappyusers
eat s heet!
                             ch

http://www.snook.ca/archives/000531.php
Of course,
just think of it as magic.


  Sam Stephenson,
author of Prototype
1.6
Visual effects
Drag and Drop
s of c ode!
2 line
Ready-to-use controls
Real-time search
Autocompleting
Drag and Drop
 Inplace editor
      Slider
Plus some extras
JavaScript unit testing, DOM Builder
orcreatehappyusers
Docs & Help
• Wiki:
  http://wiki.script.aculo.us/
• Mailing list:
  http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
• IRC channel:
  #prototype on freenode.net
Add-ons
event:Selectors




http://encytemedia.com/event-selectors/
Lightbox JS




http://www.huddletogether.com/projects/lightbox2/
Windows




http://blogus.xilinus.com/pages/javawin
Visual effects
Sliding panels and homegrown effects
Advanced
engine for visual effects
     Time-based
Complex effects easily
        possible
More than just „eye candy“
      Visual feedback
Loading times „feel shorter“
 Can help move away from
    proprietary plugins
On board

  Often-used effects
„Yellow Fade Technique“
    Fade in and out
     Sliding panels
    Puff, Shake, etc.
orcreatehappyusers
orcreatehappyusers
orcreatehappyusers
at sh eet!
che




  http://www.slash7.com/articles/2006/04/22/
          scriptaculous-cheat-sheet-1
Do-it-yourself effects

    Very easy to do
Automatically use all the
features from the visual
     effects engine
Complete tutorial &
        demo code:
http://www.thinkvitamin.com/features/
   ajax/create-your-own-ajax-effects
Activity indicators
  Show what‘s going on
„There‘s something going
     on, wait a sec“
       Revival of the
       animated GIF
    Both „per use“ and
„global“ indicators possible
„Local“ indicator




 for a specific request,
show/hide indicator image
„Global“ indicator




   for a all Ajax requests,
appear/fade an indicator image
Need an indicator image?




    http://www.ajaxload.info/
Annonyances &
 Debugging
Lessons learned
from a year of Ajax
Not all Browsers are
  created equal.
CSS
CSS can eliminate or save on
      server accesses
  HTML sizes are reduced
Be creative, CSS is extremely
           capable
JavaScript performance
DOM-API can be slow
Firefox is the slowest (better in 1.5)
Caching references in JavaScript vars
     .innerHTML is your friend
         Venkman profiling
Ajax Security
Ajax is as secure as any
     browser request
     So: Don‘t trust it
Always verify user submitted
    data on the server
Which data format?
Trivial updates: HTML
Complex updates: JavaScript
   Use HTTP caching
   Don‘t overengineer
                        ragm atic!
                 be p
Some helpful hints
Local calls only

• Ajax can only call originating server
• Also works with file:// URLs
• Use server-side proxying if you want to tie in
  other services
The Back button

• The browser back button works by returning the
  user to the last „non-ajax“ loaded page
• Keep that in mind, especially for public sites
• Workarounds available, but aren‘t working with
  all browsers
display: none

• Don‘t use display:none in external CSS
• Browser can‘t determine the original (built-in)
  display value of an element (like „block“ for DIVs,
  and „inline“ for SPANs)
• Use the style attribute instead:
  <div style=“display:none“>...</div>
Internet Explorer
                image cache
• Internet Explorer doesn‘t use its cache when
  HTML page fragments that are inserted via Ajax
  are loading images (IMG tag)
• Some proprietary HTTP headers exist to work
  around this (hey, it‘s Microsoft!):
• http://mir.aculo.us/articles/2005/08/28/internet-
  explorer-and-ajax-image-caching-woes
The verboten IDs
         of Internet Explorer

• IE 6 has some bugs regarding naming ID attributes
• Don‘t use: „length“, „item“, „namedItem“, „tags“
  or „urns“
• http://meyerweb.com/eric/thoughts/2005/08/29/
  reserved-id-values/
JavaScript objects
new Ajax.Updater('test', 'update.php', {
  onComplete: function() {},
  insertion: Insertion.Top,
});

                                   evil comma
This code works in Firefox,
                                   of browser
   but doesn‘t in Safari.
                                      death


        Always test in all browsers you
              want to support!
Debugging JavaScript
No rocket surgery here
The first
  rule of
  AJAX
debugging:
Use Firefox
The second
  rule of
  AJAX
debugging:
Use Firefox
  +Extensions
Firebug
Firebug




    Version 0.4 will include a
lightweight JavaScript debugger
Web Developer
  Extension
Venkman JavaScript
    Debugger




                     oes
               also d g!
                profilin
Tamperdata
The third
    rule:
Test with all
 browsers
you want to
  support
Safari Web Inspector
Microsoft Script
       Debugger for IE


• http://blogs.msdn.com/ie/archive/
  2004/10/26/247912.aspx
„It‘s more like Web 3.0“
What can you actually do with all this?
Available now
  www.fluxiom.com
Q&A

More Related Content

PDF
Building testable chrome extensions
PDF
jQuery Chicago 2014 - Next-generation JavaScript Testing
PPTX
Browser Automated Testing Frameworks - Nightwatch.js
PDF
Join the darkside: Selenium testing with Nightwatch.js
PDF
Real World Selenium Testing
PPTX
UI Testing Automation - Alex Kalinovsky - CreamTec LLC
KEY
Enterprise Strength Mobile JavaScript
PDF
Front-end Automated Testing
Building testable chrome extensions
jQuery Chicago 2014 - Next-generation JavaScript Testing
Browser Automated Testing Frameworks - Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.js
Real World Selenium Testing
UI Testing Automation - Alex Kalinovsky - CreamTec LLC
Enterprise Strength Mobile JavaScript
Front-end Automated Testing

What's hot (20)

PDF
Learning from the Best jQuery Plugins
PDF
Automation Abstraction Layers: Page Objects and Beyond
PDF
Front-End Testing: Demystified
PDF
High Performance JavaScript 2011
PPTX
High Performance JavaScript (CapitolJS 2011)
PDF
High Performance JavaScript (Amazon DevCon 2011)
PDF
jQuery Conference San Diego 2014 - Web Performance
PDF
jQuery Proven Performance Tips & Tricks
PDF
APIs: A Better Alternative to Page Objects
PPTX
Single Page Applications: Your Browser is the OS!
PDF
Selenium bootcamp slides
KEY
jQuery Conference Boston 2011 CouchApps
PDF
Nightwatch at Tilt
PPTX
Development of automated tests for ext js based web sites
PPT
Responsive interfaces
PPTX
Test Automation with Twist and Sahi
PPT
Introduction To Ruby Watir (Web Application Testing In Ruby)
PPTX
Angular js
PPTX
Automated UI testing done right (DDDSydney)
PPTX
An Introduction to AngularJS End to End Testing using Protractor
Learning from the Best jQuery Plugins
Automation Abstraction Layers: Page Objects and Beyond
Front-End Testing: Demystified
High Performance JavaScript 2011
High Performance JavaScript (CapitolJS 2011)
High Performance JavaScript (Amazon DevCon 2011)
jQuery Conference San Diego 2014 - Web Performance
jQuery Proven Performance Tips & Tricks
APIs: A Better Alternative to Page Objects
Single Page Applications: Your Browser is the OS!
Selenium bootcamp slides
jQuery Conference Boston 2011 CouchApps
Nightwatch at Tilt
Development of automated tests for ext js based web sites
Responsive interfaces
Test Automation with Twist and Sahi
Introduction To Ruby Watir (Web Application Testing In Ruby)
Angular js
Automated UI testing done right (DDDSydney)
An Introduction to AngularJS End to End Testing using Protractor
Ad

Viewers also liked (6)

PDF
Tuning web performance
PDF
Performance Of Web Applications On Client Machines
PDF
orcreatehappyusers
PDF
Developing High Performance Web Apps
PDF
Client-side Website Optimization
PDF
Tuning Web Performance
Tuning web performance
Performance Of Web Applications On Client Machines
orcreatehappyusers
Developing High Performance Web Apps
Client-side Website Optimization
Tuning Web Performance
Ad

Similar to orcreatehappyusers (20)

PDF
Ajax Tutorial
PPTX
JavaScript!
PDF
What's this jQuery? Where it came from, and how it will drive innovation
PPTX
J Query The Write Less Do More Javascript Library
PPS
Web Design World Flickr
PDF
New Features Coming in Browsers (RIT '09)
PPT
Decoding the Web
PPTX
CT presentatie JQuery 7.12.11
PPT
An Introduction to Ajax Programming
PPT
Easy javascript
PPT
Learn javascript easy steps
PDF
Performance Improvements In Browsers
PDF
Performance Improvements in Browsers
PPT
State of jQuery - AspDotNetStorefront Conference
PPT
PPT
Ajax Ppt 1
KEY
Week 4 - jQuery + Ajax
KEY
Drupal 6 JavaScript and jQuery
PDF
Web2.0 with jQuery in English
PPTX
Jquery beltranhomewrok
Ajax Tutorial
JavaScript!
What's this jQuery? Where it came from, and how it will drive innovation
J Query The Write Less Do More Javascript Library
Web Design World Flickr
New Features Coming in Browsers (RIT '09)
Decoding the Web
CT presentatie JQuery 7.12.11
An Introduction to Ajax Programming
Easy javascript
Learn javascript easy steps
Performance Improvements In Browsers
Performance Improvements in Browsers
State of jQuery - AspDotNetStorefront Conference
Ajax Ppt 1
Week 4 - jQuery + Ajax
Drupal 6 JavaScript and jQuery
Web2.0 with jQuery in English
Jquery beltranhomewrok

More from tutorialsruby (20)

PDF
&lt;img src="../i/r_14.png" />
PDF
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
PDF
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
PDF
&lt;img src="../i/r_14.png" />
PDF
&lt;img src="../i/r_14.png" />
PDF
Standardization and Knowledge Transfer – INS0
PDF
xhtml_basics
PDF
xhtml_basics
PDF
xhtml-documentation
PDF
xhtml-documentation
PDF
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
PDF
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
PDF
HowTo_CSS
PDF
HowTo_CSS
PDF
BloggingWithStyle_2008
PDF
BloggingWithStyle_2008
PDF
cascadingstylesheets
PDF
cascadingstylesheets
&lt;img src="../i/r_14.png" />
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
Standardization and Knowledge Transfer – INS0
xhtml_basics
xhtml_basics
xhtml-documentation
xhtml-documentation
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
HowTo_CSS
HowTo_CSS
BloggingWithStyle_2008
BloggingWithStyle_2008
cascadingstylesheets
cascadingstylesheets

Recently uploaded (20)

PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Modernizing your data center with Dell and AMD
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
PDF
Approach and Philosophy of On baking technology
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Advanced IT Governance
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Advanced Soft Computing BINUS July 2025.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Modernizing your data center with Dell and AMD
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
Spectral efficient network and resource selection model in 5G networks
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Chapter 3 Spatial Domain Image Processing.pdf
Network Security Unit 5.pdf for BCA BBA.
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
Approach and Philosophy of On baking technology
Understanding_Digital_Forensics_Presentation.pptx
Advanced IT Governance
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Review of recent advances in non-invasive hemoglobin estimation
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Advanced Soft Computing BINUS July 2025.pdf

orcreatehappyusers