Skip to content

Instantly share code, notes, and snippets.

@dcolthorp
Created June 29, 2011 11:43
Show Gist options
  • Save dcolthorp/1053694 to your computer and use it in GitHub Desktop.
Save dcolthorp/1053694 to your computer and use it in GitHub Desktop.
// Translate our messages into expand directives.
var messageDirectives = $.map(ajaxResult, formatMessage);
// Replace the dashboard placeholder with a newly cloned
// DOM node copied from #message-template and expanded
// with our messages.
$("#dashboard .placeholder").
replaceWith(
$("#messages-template").
expand(messageDirectives));
// Interpolate the most recent message directly into
// the existing sidebar element
$("#sidebar .latest-message").
expandInPlace(messageDirectives[0]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment