it is not possible to do names(NULL) <- value, so return early when choices is NULL

https://groups.google.com/forum/?pli=1#!topic/shiny-discuss/K7chwrMCvkU
only do mapply() when length(choices) > 0, otherwise options = list(), and this will lead to an empty checkbox/radio group
pass the selected value(s) to checkbox/radio group
fixes #176: the problem of choices=NULL also affects selectInput()
per suggestion of @wch, we do not pass the selected/checked status in the message; the selected values are in message$value, and they will be set via this.setValue(el, data.value) in receiveMessage() in shiny.js

also note that updateSelectInput() is essentially the same as updateCheckboxGroupInput() now, because it does not matter if the attribute name is 'selected' or 'checked'
`selected` refers to values instead of labels/names of `choices`

added validateSelected() for backward compatibility
roxygenize
update JS tests accordingly

note that getState() no longer includes state.options.selected/checked, which is actually redundant since there is state.value
news for #340
yes, it is weird to select by names instead of values; now the weirdness has gone
Ignore NULL tag elements

We already do the right thing for NULL tag attributes
also include input ID in the warning message, per suggestion of @jcheng5
move assignments out, per suggestion of @hadley
an extra )
and a missing )
a missing space
cosmetic changes, just because Github is not aware of my new commits for the PR after it was down
Merge pull request #355 from jcheng5/bugfix/null-children

Ignore NULL tag elements
Remove extraneous library calls
Fix issue #359: Factors in HTML attributes are being converted to their numeric, not character, equivalent

This bug was introduced in 3fc1410. Essentially it boils down to the difference between stringifying a factor, and stringifying a list containing a factor:

> as.character(factor('a'))
[1] "a"
> as.character(list(factor('a')))
[1] "1"
The call to split that was introduced in this commit ends up generating lists of factors, not vectors of them.

The best fix I could find was to convert all the attribute values to character before doing the split.