Commit 363a89d yehuya
committed
1 parent f41b45d commit 363a89d Copy full SHA for 363a89d
File tree 2 files changed +14
-1
lines changed
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -125,7 +125,8 @@ function createDOMPurify(window: WindowLike = getGlobal()): DOMPurify {
125
125
if (
126
126
! window ||
127
127
! window . document ||
128
- window . document . nodeType !== NODE_TYPE . document
128
+ window . document . nodeType !== NODE_TYPE . document ||
129
+ ! window . Element
129
130
) {
130
131
// Not running in a browser, provide a factory function
131
132
// so that you can pass your own Window
Original file line number Diff line number Diff line change 870
870
DOMPurify ( { document : 'not really a document' } ) . sanitize ,
871
871
undefined
872
872
) ;
873
+ assert . strictEqual (
874
+ typeof DOMPurify ( { ...window , Element : undefined } ) . version ,
875
+ 'string'
876
+ ) ;
877
+ assert . strictEqual (
878
+ DOMPurify ( { ...window , Element : undefined } ) . isSupported ,
879
+ false
880
+ ) ;
881
+ assert . strictEqual (
882
+ DOMPurify ( { ...window , Element : undefined } ) . sanitize ,
883
+ undefined
884
+ ) ;
873
885
assert . strictEqual ( typeof DOMPurify ( window ) . version , 'string' ) ;
874
886
assert . strictEqual ( typeof DOMPurify ( window ) . sanitize , 'function' ) ;
875
887
} ) ;
You can’t perform that action at this time.
0 commit comments