Skip to content

Commit

Permalink
Fix PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Emanuel Tesar committed Sep 16, 2019
1 parent 57e405f commit 941ec84
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ describe('when Trusted Types are available in global object', () => {
"to 'innerHTML' will throw an error if Trusted Types are enforced. " +
"You can try to wrap your svg element inside a div and use 'dangerouslySetInnerHTML' " +
'on the enclosing div instead.',
{withoutStack: true},
);
});
});
Expand All @@ -96,10 +95,7 @@ describe('when Trusted Types are available in global object', () => {
' in script (at **)',
);

const spy = spyOnDev(console, 'error');
// check that the warning is print only once
ReactDOM.render(<script>alert("I am not executed")</script>, container);
if (__DEV__) {
expect(spy).toHaveBeenCalledTimes(0);
}
});
});
4 changes: 2 additions & 2 deletions packages/react-dom/src/client/setInnerHTML.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import {Namespaces} from '../shared/DOMNamespaces';
import createMicrosoftUnsafeLocalFunction from '../shared/createMicrosoftUnsafeLocalFunction';
import warningWithoutStack from 'shared/warningWithoutStack';
import warning from 'shared/warning';
import type {TrustedValue} from './ToStringValue';
import {enableTrustedTypesIntegration} from 'shared/ReactFeatureFlags';

Expand All @@ -32,7 +32,7 @@ const setInnerHTML = createMicrosoftUnsafeLocalFunction(function(
// the target node
if (node.namespaceURI === Namespaces.svg) {
if (enableTrustedTypesIntegration && __DEV__) {
warningWithoutStack(
warning(
// $FlowExpectedError - trustedTypes are defined only in some browsers or with polyfill
typeof trustedTypes === 'undefined',
"Using 'dangerouslySetInnerHTML' in an svg element with " +
Expand Down

0 comments on commit 941ec84

Please sign in to comment.