Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Pollyfills

sjonnet
April 16, 2012

 Pollyfills

sjonnet

April 16, 2012
Tweet

More Decks by sjonnet

Other Decks in Technology

Transcript

  1. Polyfills “Polyfills are a type of shim that retrofit legacy

    browsers with HTML5/CSS3 features” - Remy Sharp Monday, April 16, 12
  2. Shims “Shims refer to any code that intercepts API calls

    and provides a layer of abstraction” - Paul Irish Monday, April 16, 12
  3. Use cases •Use native capabilities if a browser does support

    a feature •Use fallbacks (Java applets, Flash, JS) for browsers that don't •Provide as consistent an experience as is possible Polyfills help us use today's modern features in yesterday's browsers Monday, April 16, 12
  4. Note •Just because you can load a polyfill doesn't mean

    you should •The fastest loading page on the planet is this - about:blank :) •Each thing added to this page means more time the browser has to spend loading or processing Monday, April 16, 12
  5. Remember “Degradation is your friend” “Build for the future and

    degrade for the past.” - Shawn Jonnet •Just because you can load a polyfill doesn't mean you should •The fastest loading page on the planet is this - about:blank :) •Each thing added to this page means more time the browser has to spend loading or processing Monday, April 16, 12
  6. Loading Modules •yepnope.js (standalone, Modernizr) - Alex Sexton •LabJS -

    Kyle Simpson •YeahNo.js - also by Kyle There are some great script loaders that can help with conditional loading Monday, April 16, 12
  7. Each / forEach Iterates over a list of elements, yielding

    each in turn to an iterator function. Monday, April 16, 12
  8. Map Produces a new array of values by mapping each

    value in list through a transformation function (iterator). Monday, April 16, 12
  9. Reduce Reduce boils down a list of values into a

    single value. Monday, April 16, 12
  10. Find Looks through each value in the list, returning the

    first one that passes a truth test (iterator) Monday, April 16, 12
  11. Filter Looks through each value in the list, returning an

    array of all the values that pass a truth test (iterator). Monday, April 16, 12