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

UpFront Presentation

UpFront Presentation

I presented at the 25th UpFront usergroup meetup in Berlin. These are the slides. See more from UpFront at http://up.front.ug

Kelly Sutton

April 09, 2012
Tweet

Other Decks in Programming

Transcript

  1. <script> for (var i = 0; i < this.versions.length; i++)

    { $('#Version' + i + ' img') .attr('src', '/bankrupt.png'); } </script>
  2. <script> for (var i = 0; i < this.versions.length; i++)

    { $('#Version' + i + ' img') .attr('src', '/bankrupt.png'); } </script> Implies you’re keeping a reference to what exists on the page.
  3. <script> for (var i = 0; i < this.versions.length; i++)

    { $('#Version' + i + ' img') .attr('src', '/bankrupt.png'); } </script> Implies you’re keeping a reference to what exists on the page. It also implies you’re an idiot.
  4. <script> for (var i = 0; i < this.versions.length; i++)

    { $('#Version' + i + ' img') .attr('src', '/bankrupt.png'); } </script> This is not 2005. Also, your i is kind of being a dick.
  5. DO

  6. <script> // within a "class"... initialize: function () { $('#Container')

    .on('click', 'li', this.delegate(this.onClick)); }, onClick: function (event) { // Do work, maybe use some data-* attributes }, //... </script>
  7. <script> // ... initialize: function () { this.addEventListener( "openWormhole", this.delegate(this.onOpenWormhole)

    ); }, // ... </script> <script> // Somewhere in the nethers of the code this.fireEvent("openWormhole"); </script>