Merge pull request #5886 from goatslacker/cant-dangerouslysetinnerhtml-for-option

Only add children in ReactDOMOption when there are children
This commit is contained in:
Ben Alpert
2016-01-19 15:12:09 -08:00
2 changed files with 12 additions and 1 deletions
@@ -85,7 +85,10 @@ var ReactDOMOption = {
}
});
nativeProps.children = content;
if (content) {
nativeProps.children = content;
}
return nativeProps;
},
@@ -63,4 +63,12 @@ describe('ReactDOMOption', function() {
expect(console.error.calls.length).toBe(0);
expect(node.innerHTML).toBe('1 2');
});
it('should be able to use dangerouslySetInnerHTML on option', function() {
var stub = <option dangerouslySetInnerHTML={{ __html: 'foobar' }} />;
stub = ReactTestUtils.renderIntoDocument(stub);
var node = ReactDOM.findDOMNode(stub);
expect(node.innerHTML).toBe('foobar');
});
});