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

Pragmatic Performance with Third-Party JavaScript

Pragmatic Performance with Third-Party JavaScript

Presentation for Twitter at Open Web Camp 2012, in San Jose, CA. Covers a chunk of what we've learned over the years in building JavaScript for off-network usage, with aggressive performance optimisations.

Ben Ward

July 14, 2012
Tweet

More Decks by Ben Ward

Other Decks in Programming

Transcript

  1. <!DOCTYPE html> <html> <head> <title>Twitter Tweet Button</title> <style type="text/css">/* minified

    stylesheet */</style> </head> <body> <a class="button">Tweet</a> <a class="count"></a> <script> // minified JavaScript </script> </body> </html>
  2. .btn { border-radius: 6px; background: linear-gradient(top, white, #DEDEDE); text-shadow: 0

    1px 0 rgba(255, 255, 255, .5); } .btn:hover, .btn:focus { box-shadow: inset 0 0 10px #000000; }
  3. <script>!function (doc, script, id) { var js, first = doc.getElementsByTagName(script)[0];

    if (!doc.getElementById(id)) { js = doc.createElement(script); js.id = id; js.src = "//platform.twitter.com/widgets.js"; first.parentNode.insertBefore(js, first); } }(document,"script","twitter-wjs");</script>