File tree 2 files changed +15
-2
lines changed 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ class Modal extends Component {
57
57
} )
58
58
] ) ,
59
59
appElement : PropTypes . oneOfType ( [
60
- PropTypes . instanceOf ( SafeHTMLElement ) ,
60
+ SafeHTMLElement ,
61
61
PropTypes . instanceOf ( SafeHTMLCollection ) ,
62
62
PropTypes . instanceOf ( SafeNodeList ) ,
63
63
PropTypes . arrayOf ( PropTypes . instanceOf ( SafeHTMLElement ) )
Original file line number Diff line number Diff line change @@ -2,7 +2,20 @@ import ExecutionEnvironment from "exenv";
2
2
3
3
const EE = ExecutionEnvironment ;
4
4
5
- const SafeHTMLElement = EE . canUseDOM ? window . HTMLElement : { } ;
5
+ const NodeTypeElement = 1 ;
6
+
7
+ const IHTMLElement = function ( props , propName ) {
8
+ const element = props [ propName ] ;
9
+ const is = element . nodeType === NodeTypeElement &&
10
+ element . setAttribute &&
11
+ element . removeAttribute ;
12
+
13
+ if ( ! is ) {
14
+ return new Error ( `Warning: Failed %s type: %s%s', 'prop', Invalid prop \`${ propName } \` supplied to \`Modal\`` ) ;
15
+ }
16
+ } ;
17
+
18
+ export const SafeHTMLElement = EE . canUseDOM ? IHTMLElement : { } ;
6
19
7
20
export const SafeHTMLCollection = EE . canUseDOM ? window . HTMLCollection : { } ;
8
21
You can’t perform that action at this time.
0 commit comments