@@ -831,7 +831,7 @@ export class ElementInjector extends TreeNode<ElementInjector> {
831831 directParent ( ) : ElementInjector { return this . _proto . distanceToParent < 2 ? this . parent : null ; }
832832
833833 private _isComponentKey ( key : Key ) {
834- return this . _proto . _firstBindingIsComponent && key . id === this . _proto . _keyId0 ;
834+ return this . _proto . _firstBindingIsComponent && isPresent ( key ) && key . id === this . _proto . _keyId0 ;
835835 }
836836
837837 private _isDynamicallyLoadedComponentKey ( key : Key ) {
@@ -1134,7 +1134,11 @@ export class ElementInjector extends TreeNode<ElementInjector> {
11341134 private _getByKey ( key : Key , visibility : Visibility , optional : boolean , requestor : Key ) {
11351135 var ei = this ;
11361136
1137- var currentVisibility = LIGHT_DOM ;
1137+ var currentVisibility = this . _isComponentKey ( requestor ) ?
1138+ LIGHT_DOM_AND_SHADOW_DOM : // component can access both shadow dom
1139+ // and light dom dependencies
1140+ LIGHT_DOM ;
1141+
11381142 var depth = visibility . depth ;
11391143
11401144 if ( ! visibility . shouldIncludeSelf ( ) ) {
@@ -1144,9 +1148,7 @@ export class ElementInjector extends TreeNode<ElementInjector> {
11441148 ei = ei . _parent ;
11451149 } else {
11461150 ei = ei . _host ;
1147- if ( ! visibility . crossComponentBoundaries ) {
1148- currentVisibility = SHADOW_DOM ;
1149- }
1151+ currentVisibility = visibility . crossComponentBoundaries ? LIGHT_DOM : SHADOW_DOM ;
11501152 }
11511153 }
11521154
@@ -1159,15 +1161,14 @@ export class ElementInjector extends TreeNode<ElementInjector> {
11591161
11601162 depth -= ei . _proto . distanceToParent ;
11611163
1164+ // we check only one mode with the SHADOW_DOM visibility
11621165 if ( currentVisibility === SHADOW_DOM ) break ;
11631166
11641167 if ( isPresent ( ei . _parent ) ) {
11651168 ei = ei . _parent ;
11661169 } else {
11671170 ei = ei . _host ;
1168- if ( ! visibility . crossComponentBoundaries ) {
1169- currentVisibility = SHADOW_DOM ;
1170- }
1171+ currentVisibility = visibility . crossComponentBoundaries ? LIGHT_DOM : SHADOW_DOM ;
11711172 }
11721173 }
11731174
0 commit comments