File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 11// @flow
22const prefixes = [ 'Moz' , 'Webkit' , 'O' , 'ms' ] ;
33export function getPrefix ( prop : string = 'transform' ) : string {
4- // Checking specifically for 'window.document' is for pseudo-browser server-side
5- // environments that define 'window' as the global context.
6- // E.g. React-rails (see https://github.com/reactjs/react-rails/pull/84)
7- if ( typeof window === 'undefined' || typeof window . document === 'undefined' ) return '' ;
8-
9- const style = window . document . documentElement . style ;
4+ // Ensure we're running in an environment where there is actually a global
5+ // `window` obj
6+ if ( typeof window === 'undefined' ) return '' ;
7+
8+ // If we're in a pseudo-browser server-side environment, this access
9+ // path may not exist, so bail out if it doesn't.
10+ const style = window . document ?. documentElement ?. style ;
11+ if ( ! style ) return '' ;
1012
1113 if ( prop in style ) return '' ;
1214
You can’t perform that action at this time.
0 commit comments