@@ -745,15 +745,31 @@ function baseCreateRenderer(
745
745
}
746
746
}
747
747
// scopeId
748
- if ( scopeId ) {
749
- hostSetScopeId ( el , scopeId )
750
- }
751
- const treeOwnerId = parentComponent && parentComponent . type . __scopeId
752
- // vnode's own scopeId and the current patched component's scopeId is
753
- // different - this is a slot content node.
754
- if ( treeOwnerId && treeOwnerId !== scopeId ) {
755
- hostSetScopeId ( el , treeOwnerId + '-s' )
756
- }
748
+ setScopeId ( el , scopeId , vnode , parentComponent )
749
+ // if (scopeId) {
750
+ // hostSetScopeId(el, scopeId)
751
+ // }
752
+ // if (parentComponent) {
753
+ // const treeOwnerId = parentComponent.type.__scopeId
754
+ // // vnode's own scopeId and the current patched component's scopeId is
755
+ // // different - this is a slot content node.
756
+ // if (treeOwnerId && treeOwnerId !== scopeId) {
757
+ // hostSetScopeId(el, treeOwnerId + '-s')
758
+ // }
759
+ // const parentScopeId =
760
+ // vnode === parentComponent.subTree && parentComponent.vnode.scopeId
761
+ // if (parentScopeId) {
762
+ // hostSetScopeId(el, parentScopeId)
763
+ // if (parentComponent.parent) {
764
+ // const treeOwnerId = parentComponent.parent.type.__scopeId
765
+ // // vnode's own scopeId and the current patched component's scopeId is
766
+ // // different - this is a slot content node.
767
+ // if (treeOwnerId && treeOwnerId !== parentScopeId) {
768
+ // hostSetScopeId(el, treeOwnerId + '-s')
769
+ // }
770
+ // }
771
+ // }
772
+ // }
757
773
}
758
774
if ( __DEV__ || __FEATURE_PROD_DEVTOOLS__ ) {
759
775
Object . defineProperty ( el , '__vnode' , {
@@ -791,6 +807,33 @@ function baseCreateRenderer(
791
807
}
792
808
}
793
809
810
+ const setScopeId = (
811
+ el : RendererElement ,
812
+ scopeId : string | false | null ,
813
+ vnode : VNode ,
814
+ parentComponent : ComponentInternalInstance | null
815
+ ) => {
816
+ if ( scopeId ) {
817
+ hostSetScopeId ( el , scopeId )
818
+ }
819
+ if ( parentComponent ) {
820
+ const treeOwnerId = parentComponent . type . __scopeId
821
+ // vnode's own scopeId and the current patched component's scopeId is
822
+ // different - this is a slot content node.
823
+ if ( treeOwnerId && treeOwnerId !== scopeId ) {
824
+ hostSetScopeId ( el , treeOwnerId + '-s' )
825
+ }
826
+ if ( vnode === parentComponent . subTree ) {
827
+ setScopeId (
828
+ el ,
829
+ parentComponent . vnode . scopeId ,
830
+ parentComponent . vnode ,
831
+ parentComponent . parent
832
+ )
833
+ }
834
+ }
835
+ }
836
+
794
837
const mountChildren : MountChildrenFn = (
795
838
children ,
796
839
container ,
0 commit comments