File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 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 {
125125 if (
126126 ! window ||
127127 ! window . document ||
128- window . document . nodeType !== NODE_TYPE . document
128+ window . document . nodeType !== NODE_TYPE . document ||
129+ ! window . Element
129130 ) {
130131 // Not running in a browser, provide a factory function
131132 // so that you can pass your own Window
Original file line number Diff line number Diff line change 870870 DOMPurify ( { document : 'not really a document' } ) . sanitize ,
871871 undefined
872872 ) ;
873+ assert . strictEqual (
874+ typeof DOMPurify ( { document, Element : undefined } ) . version ,
875+ 'string'
876+ ) ;
877+ assert . strictEqual (
878+ DOMPurify ( { document, Element : undefined } ) . isSupported ,
879+ false
880+ ) ;
881+ assert . strictEqual (
882+ DOMPurify ( { document, Element : undefined } ) . sanitize ,
883+ undefined
884+ ) ;
873885 assert . strictEqual ( typeof DOMPurify ( window ) . version , 'string' ) ;
874886 assert . strictEqual ( typeof DOMPurify ( window ) . sanitize , 'function' ) ;
875887 } ) ;
You can’t perform that action at this time.
0 commit comments