Skip to content

Instantly share code, notes, and snippets.

@sycobuny
Created April 26, 2013 18:11
Show Gist options
  • Save sycobuny/5469218 to your computer and use it in GitHub Desktop.
Save sycobuny/5469218 to your computer and use it in GitHub Desktop.
This is a wacky way to implement a "switch"-type construct I just thought would be interesting to use
var addCell = function($row, inner, addAs) {
var $cell = $(document.createElement('td'))
{
html: function() { $cell.html (inner) },
text: function() { $cell.text (inner) },
child: function() { $cell.append(inner) }
}[addAs ? addAs : 'text']()
$row.append($cell)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment