facebook/react — pull request #1428 by yazaddaruvala (2014-04-21 10:28:47+00:00)
Title: Render to string or markup is broken for React.DOM.select

Providing a value or a default value to a select doesn't do anything while rendering that component to a string or markup. http://jsfiddle.net/tsNqr/2/. Let me know if you need more info than this.

Actually I decided to help.
*Problem*:
The issue is that `ReactDOMSelect` has a dependence on `getDOMNode()` so as to mark child `
`s as selected. It does this as a post render mutation on the DOM.

For obvious reasons this doesn't work for rendering to a string.

*Solution*:
Instead of marking the children as selected in a post render hook, I just mark their descriptors as selected (or not) before they are rendered.

*Notes*:
Since React's mantra is all about not mutating things and that the render method defines how the component looks at all possible times. The current `ReactDOMSelect` implementation seems pretty counter intuitive to me. All the tests pass but my worry is that the current implementation was forced this way in order to fix an obscure bug..? If you guys know why its done this way, please let me know, we can try to find another fix.

*PS.*
I'd like to add these validations to `ReactDOMSelect`, let me know what you think
`this.props.children.all(_.type === 'option')`
`this.props.value xor this.props.defaultValue xor this.props.children.any(_.props.selected != null)`