File tree 1 file changed +8
-6
lines changed
1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 1
1
// @flow
2
2
const prefixes = [ 'Moz' , 'Webkit' , 'O' , 'ms' ] ;
3
3
export 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 '' ;
10
12
11
13
if ( prop in style ) return '' ;
12
14
You can’t perform that action at this time.
0 commit comments