Merge pull request #3727 from spicyj/dsih
Relax dangerouslySetInnerHTML validation
This commit is contained in:
commit
0183f70797
|
@ -72,7 +72,8 @@ function assertValidProps(component, props) {
|
|||
'Can only set one of `children` or `props.dangerouslySetInnerHTML`.'
|
||||
);
|
||||
invariant(
|
||||
props.dangerouslySetInnerHTML.__html != null,
|
||||
typeof props.dangerouslySetInnerHTML === 'object' &&
|
||||
'__html' in props.dangerouslySetInnerHTML,
|
||||
'`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' +
|
||||
'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' +
|
||||
'for more information.'
|
||||
|
|
|
@ -443,6 +443,12 @@ describe('ReactDOMComponent', function() {
|
|||
);
|
||||
});
|
||||
|
||||
it('should allow {__html: null}', function() {
|
||||
expect(function() {
|
||||
mountComponent({dangerouslySetInnerHTML: {__html: null} });
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it("should warn about contentEditable and children", function() {
|
||||
spyOn(console, 'error');
|
||||
mountComponent({contentEditable: true, children: ''});
|
||||
|
|
Loading…
Reference in New Issue