Created
April 26, 2013 18:11
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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