File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -41,13 +41,14 @@ export class Directionality {
41
41
change = new EventEmitter < void > ( ) ;
42
42
43
43
constructor ( @Optional ( ) @Inject ( DIR_DOCUMENT ) _document ?: any ) {
44
- if ( typeof _document === 'object' && ! ! _document ) {
44
+ if ( _document ) {
45
45
// TODO: handle 'auto' value -
46
46
// We still need to account for dir="auto".
47
47
// It looks like HTMLElemenet.dir is also "auto" when that's set to the attribute,
48
48
// but getComputedStyle return either "ltr" or "rtl". avoiding getComputedStyle for now
49
- // though, we're already calling it for the theming check.
50
- this . value = ( _document . body . dir || _document . documentElement . dir || 'ltr' ) as Direction ;
49
+ const bodyDir = _document . body ? _document . body . dir : null ;
50
+ const htmlDir = _document . documentElement ? _document . documentElement . dir : null ;
51
+ this . value = ( bodyDir || htmlDir || 'ltr' ) as Direction ;
51
52
}
52
53
}
53
54
}
You can’t perform that action at this time.
0 commit comments