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 {
4141 change = new EventEmitter < void > ( ) ;
4242
4343 constructor ( @Optional ( ) @Inject ( DIR_DOCUMENT ) _document ?: any ) {
44- if ( typeof _document === 'object' && ! ! _document ) {
44+ if ( _document ) {
4545 // TODO: handle 'auto' value -
4646 // We still need to account for dir="auto".
4747 // It looks like HTMLElemenet.dir is also "auto" when that's set to the attribute,
4848 // 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 ;
5152 }
5253 }
5354}
You can’t perform that action at this time.
0 commit comments